I am writing a basic space ship simulation and I need to tell if one object is facing another object. So the ship can determine if it should fire. (I use an objects x axis directional vector as the direction the object is facing)
At the moment I determine the xy plane of object A and see how far away object B is from this plane. Then I determine the zx plane of object A and see how far away object B is from this plane. Then I use Pythagorus to determine how far away object B is from the line formed by object A's x axis directional vector.
This is very computationaly expansive. Is there a better simpler way to tell if an object is in line with another (ie Object A has object be in it's sights)
0 · ·