; PointEntity Example ; ------------------- Graphics3D 640,480,0,2 SetBuffer BackBuffer() camera=CreateCamera() PositionEntity camera,0,2,-10 light=CreateLight() RotateEntity light,45,45,0 ; A turret barrel (long in z, the "forward" axis that PointEntity aims) barrel=CreateCube() ScaleMesh barrel,0.2,0.2,1 EntityColor barrel,255,255,0 ; A drone that flies loops around the turret drone=CreateSphere(8) ScaleEntity drone,0.4,0.4,0.4 EntityColor drone,0,255,0 angle#=0 While Not KeyDown(1) ; Fly the drone in a weaving circle angle=angle+1 PositionEntity drone,Cos(angle)*4,Sin(angle*3),Sin(angle)*4 ; Keep the turret barrel aimed at the drone PointEntity barrel,drone ; 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 Esc: exit" Text 0,20,"PointEntity barrel,drone keeps the barrel aimed at the moving drone" Flip Wend End