Absolute Heading -
09-26-2010, 04:14 PM
I'm working on a flight simulator project. Here's the problem. The player needs to be able to control yaw (left/right motion). But simply having the plane turn right and left without rolling right and left doesn't look realistic. But if I make the plane roll as it yaws relative to itself, altitude is affected, which is not the intention. I could adjust the pitch (up/down motion) so that constant altitude is maintained, but this seems overly difficult and complicated.
So I decided to get rid of motion relative to the plane altogether and instead go with absolute coordinates (relative to the world). The plane has properties for speed, theta (angle in the x-y plane, corresponding to yaw), phi (angle from the x-y plane up in the z-direction, corresponding to pitch), and roll. I used trig (spherical coordinates) to get the plane to move properly, and it works very nicely. However, the plane does not change its animation direction at all. I need to make the plane change its absolute heading to match its theta, phi, and roll properties.
But I don't see any methods that change absolute heading - only relative heading, e.g. "turn 1/4 revolution". Is there a method something like "set horizontal angle to 0 as seen by world"?
|