Advertisement

calculate pitch and roll from vector

Started by July 29, 2013 01:54 AM
0 comments, last by _WeirdCat_ 11 years, 6 months ago

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?

http://www.gamedev.net/topic/644492-rotation-based-on-normal-vector/#entry5071719

or if link does not work:

http://www.gamedev.net/topic/644492-rotation-based-on-normal-vector/ <- last post

This topic is closed to new replies.

Advertisement