A minor problem that I had to solve was: how to take the delta vector between the enemy ship and the player ship, and translate that into a target body attitude for the enemy ship. This was solved by a quick trip to Mathematica, and their excellent page on spherical coordinates. The conversion is as follows:
theta (swivel) angle = arctan(dy/dx)
phi (tilt) angle = arccos(dz)
where dx, dy and dz are the attributes of a vector d describing the distance and direction from the enemy ship to the player ship. This vector must first be normalized.
No comments:
Post a Comment