Okay...I've made a little test-prog, but it doesn't seem to work correctly. The 'radar' is near the bottom in the middle, and the lines' length should show the 'height' above or below the ship of the target. The basics work, but when the ship rotates, the radar should reflect this...any ideas where I'm going wrong?
(I'm not sure about the TFormPoint(x,y,z,source,target) )
Graphics3D 800,600,32,0
SetBuffer BackBuffer()
lighting=CreateLight(2)
PositionEntity lighting,-20,20,-30
ship=CreateCone(3,1)
ScaleMesh ship,2,5,1
RotateMesh ship,-90,180,0
red=CreateCube()
blue=CreateCube()
green=CreateCube()
EntityColor red,255,0,0
EntityColor green,0,255,0
EntityColor blue,0,0,255
cam=CreateCamera()
MoveEntity cam,0,0,-20
PointEntity cam,ship
PositionEntity red,Rand(-10,10),Rand(-10,10),Rand(-10,10)
PositionEntity blue,Rand(-10,10),Rand(-10,10),Rand(-10,10)
PositionEntity green,Rand(-10,10),Rand(-10,10),Rand(-10,10)
While Not KeyDown(1)
If KeyDown(208) Then TurnEntity ship,5,0,0
If KeyDown(200) Then TurnEntity ship,-5,0,0
If KeyDown(203) Then TurnEntity ship,0,-5,0
If KeyDown(205) Then TurnEntity ship,0,-5,0
If MouseDown(1) MoveEntity ship,0,0,1
UpdateWorld
RenderWorld
;Radar
Color 255,255,255
Rect 400,500,3,3,0
;Red Dot
TFormPoint (EntityX(ship),EntityY(ship),EntityZ(ship),0,red)
red_relativeX=TFormedX();-EntityX(ship)
red_relativey=TFormedY();-EntityY(ship)
red_relativez=TFormedZ();-EntityZ(ship)
Color 255,0,0
Rect 400+red_relativeX,500+red_relativeZ,1,red_relativeY,1
;Green Dot
TFormPoint (EntityX(ship),EntityY(ship),EntityZ(ship),0,green)
green_relativeX=TFormedX();-EntityX(ship)
green_relativey=TFormedY();-EntityY(ship)
green_relativez=TFormedZ();-EntityZ(ship)
Color 0,255,0
Rect 400+green_relativeX,500+green_relativeZ,1,green_relativeY,1
;Blue Dot
TFormPoint (EntityX(ship),EntityY(ship),EntityZ(ship),0,blue)
blue_relativeX=TFormedX();-EntityX(ship)
blue_relativey=TFormedY();-EntityY(ship)
blue_relativez=TFormedZ();-EntityZ(ship)
Color 0,0,255
Rect 400+blue_relativeX,500+blue_relativeZ,1,blue_relativeY,1
Flip
Wend
End