Take the tour ×  I'm trying to build a radar system like the one
in the original X-Wing games. The way it works is that there are
two circular radar systems, one for behind the ship, and one for
infront.  So, I've written a class to represent the radar, it
has a vector representing the direction the radar is facing, and
a 3D position of where the radar is. Both of these things will
change in realtime as the ship moves and so the radar will need
updating each frame.  Now I'm trying to figure out how to
transform the position of another ship onto the radar. What I
need is a final 2D X/Y coordinate between -1,-1 and 1, 1 for
plotting on the 2D radar screen.  Given two vectors (the
direction of the ship - which the radar is facing - and the
direction to the ship we are plotting), how can I calculate a 2D
X-Y position on the radar? Obviously I also have access to the
up and right vectors of the ship too.  My instinct says that
this should be relatively straightforward, but my math skills
suck.  share|improve this