- Joined
- Aug 5, 2011
- Messages
- 1,667
- Reaction score
- 3
- Points
- 38
I have an RPOS and RVEL to Earth, for a DefSetStateEx call (using GPOS, GVEL of course). I want the AROT to orient the vehicle along the velocity vector, "right way up".
My thinking: Z-hat comes from normalized RVEL, X-hat comes from cross product of RPOS and RVEL, and Y-hat is then the cross product of Z-hat and X-hat.
From this, determine the three Euler angles to rotate the global coordinate frame to this desired orientation. But when I manually orient to the desired direction, and look at AROT from a GetStateEx, I get a totally different solution.
Has anyone been through this, and can lay out the math first, and then the implementation into Orbiter API?
TIA.
My thinking: Z-hat comes from normalized RVEL, X-hat comes from cross product of RPOS and RVEL, and Y-hat is then the cross product of Z-hat and X-hat.
From this, determine the three Euler angles to rotate the global coordinate frame to this desired orientation. But when I manually orient to the desired direction, and look at AROT from a GetStateEx, I get a totally different solution.
Has anyone been through this, and can lay out the math first, and then the implementation into Orbiter API?
TIA.