Hi, got this far. It works as I want it, basically keeps the radar dot inside a 128 by 128 circle.
Problem is the scale to keep the dot inside the circle. Just using a 2D circle.
It will switch from the Planet to The Space station but I can't get an even scale to stay within the circle.
I've made the a & b vectors unit vectors, why, I don't know, but the dot product is working for infront/behind.
Any ideas? The Planet has radius 2000 but the Space station is radius 50. My problem is finding the right scale at any distance to utilise the full circle.
;-----------------------------
Function Handle_Planet_Radar()
Local x# = EntityX(Planet_Pivot)
Local y# = EntityY(Planet_Pivot)
Local z# = EntityZ(Planet_Pivot)
ax# = x - EntityX(Camera)
ay# = y - EntityY(Camera)
az# = z - EntityZ(Camera)
dist# = Sqr(ax*ax+ay*ay+az*az)
ax = ax / dist
ay = ay / dist
az = az / dist
TFormPoint 0,0,1, Camera, 0
bx# = TFormedX() - EntityX(Camera)
by# = TFormedY() - EntityY(Camera)
bz# = TFormedZ() - EntityZ(Camera)
rad_orientation = ax*bx + ay*by + az*bz
TFormPoint x,y,z, 0,Camera
dist# = Sqr( ax*ax + bx*bx + cx*cx )
Rad_Scale# = 0.03
rad_x# = TFormedX() * Rad_Scale
rad_y# = -TFormedY() * Rad_Scale
End Function