; ClearDebugDraw Example ; ---------------------- ; Requires Extended mode. Graphics3D 640,480,0,2 SetBuffer BackBuffer() camera=CreateCamera() PositionEntity camera,0,3,-9 light=CreateLight() RotateEntity light,45,45,0 ; A drone circling the arena with a full debug overlay drone=CreateCube() ScaleEntity drone,0.5,0.5,0.5 EntityColor drone,80,200,255 While Not KeyDown(1) ; The drone circles while the overlay tracks it angle#=angle+1.5 PositionEntity drone,4*Cos(angle),1.5+Sin(angle*3),4*Sin(angle) ; Queue several debug shapes for the next RenderWorld DebugGrid 12,1,0,90,90,90 DebugSphere EntityX(drone),EntityY(drone),EntityZ(drone),1,16,255,220,0 DebugLine 0,0,0,EntityX(drone),EntityY(drone),EntityZ(drone),255,80,80 ; Holding Space discards everything queued above before it is drawn If KeyDown(57) Then ClearDebugDraw ; Arrow keys move the camera If KeyDown(200) Then MoveEntity camera,0,0,0.1 If KeyDown(208) Then MoveEntity camera,0,0,-0.1 If KeyDown(203) Then TurnEntity camera,0,1,0 If KeyDown(205) Then TurnEntity camera,0,-1,0 RenderWorld Text 0,0,"Arrow keys: move camera Hold Space: ClearDebugDraw Esc: exit" If KeyDown(57) Then Text 0,20,"ClearDebugDraw dropped this frame's queued shapes" Else Text 0,20,"Grid, sphere and line are queued fresh every frame" Flip Wend End