Hi Julio, and everyone
I am using Newton Game dynamics to create a spaceflight DLL module for a flight simulator (existing application). The coordinate system which is used in this flight simulator is "local-Topocentric" coordinate system, common to aircraft flying around the globe. In this coordinate system, wherever you are on the globe, attitude is always in relation to the horizon, and pointing North (level wings is 0 roll/bank, level nose is 0 pitch, and nose pointing north is heading/yaw 0 degrees). Position is specified by Lat, Long and Altitude, and attitude is specified in Roll, Yaw and Pitch. In addition, Pitch is allowed to only go from +90 deg to -90 deg. Moreover, the coordinate system is Left-handed, while Newton is right-handed (although I don't believe that is a huge obstacle, there is a simple matrix conversion for that). So, the ONLY way of specifying object position and attitude in FS is by Latitude, Longitude, Altitude (spherical coordinates), with Pitch Bank and Heading in local-topocentric coordinate frame.
So, basically, I need to transfer Newton coordinates to my flight simulator coordinates. In order to do that, I have to calculate spherical position. That's no problem, I already have that, I've set up my Newton Physics so that I have spacecraft rotate properly under Newton's orbital influence. However, I also have to, based on spacecraft's position, calculate for attitude conversion that is accepted by Flight simulator, since roll pitch and yaw are relative to topocentric coordinate system. For example, a pitch of 90 degrees in Newton would be pitch of 90 degrees in Flight simulator, but only on north pole. On the equator, this would be a pitch of 0 degrees, and on south pole, -90 degrees.
I was wondering if you could help me out with math - I'm stuck on it. I had limited success so far, I just need to be pointed in the right direction. I know there is a right combination of rotations out there, that will do the trick and convert from one coordinate system to another. Do you have any thought or pointer on how best to approach this?
Thanks in advance,
Misho