Advertisement

radar for spaceshooter

Started by January 08, 2002 11:12 AM
1 comment, last by cody 23 years, 1 month ago
hi anyone knows the radar displays from privateer or wing commander? the middle of the radar screen is in front of you, the farer its away from the center the farer you must rotate to face it. a point in the most outer region is behind you. (dont know if anybody understands this...) i know the position of my spaceship, the rotation(quaternion) and the same of the spaceship to display on the radar. i can calculate the distance from the radar center to the displayed point by the dot product of the direction-vector of my spaceship and the vector from my spaceships position to the position of the other spaceship. but i dont know how to calculate the angle to rotate the point around the center.(if the other spaceship is left/right/up/down) hope somebody can help.
You´ll have to get the angle between the heading of the radar and that of the other ship:

  //It we say that the origin of our ship is (0,0,0), we do this://Note: To move the ship and other thing, substract the ship´s// origin from all ships´ originsfloat r = acosf( DotProduct( heading, ship.origin ) / (heading.Magnitude() * ship.origin.Magnitude() ) );  

It you should be in 2d, it´s just the same....We just remove z from all calcs....
delete this;
Advertisement
hmm... this formula doesnt look richt, perhaps my explanation wasnt so good.

i know the angle how far the other spaceship is away from center( dot(heading,vector_to_other_spaceship)), but i dont know the direction:-(

This topic is closed to new replies.

Advertisement