# discoross

Member

20

102 Neutral

• Rank
Member
1. ## calculate pitch and roll from vector

Hi all,   I'm working on a simple plane sim that can only roll and pitch. It cannot yaw. There is no inertia or slippage so that all velocity is in the x direction in the body frame (y being to my right, z is my down) like this. Say I'm given a second vector that I want to try and align myself with. If the vector is in the +- z direction, I can pitch to get there. But if there is any y component to the vector (in my body frame), then I will have to do some combination of roll and pitch to get there. For example, if it's in my x-y plane but directly to my left, I'll have to roll by -pi/2, then pitch until I'm aligned. Or I could start pitching while rolling. It seems to me like there would be multiple ways to achieve the same action. Is there a standard way to compute this sort of thing? I've seen a good number of examples where yaw is not constrained, in which case you can do something like yaw=atan2(-vel.y, vel.x);  Any idea for the yaw-constrained case?