Jump to content
  • Advertisement
Sign in to follow this  
jackharmon

Coordinated PITCH and YAW rotation?

This topic is 4596 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have a problem where I can yaw my model and pitch my model fine, but when I am at 90 degree pitch, and I try to yaw, the model ROLLS instead. Or, if my model is 90 degrees yaw rotation, and I try to pitch, it ends up ROLLing as well. Anyone have example code that demonstrates using coordinated pitch and yaw? Kinda like an airplane in zero gravity using elevators and rudder without ailerons. Thanks!

Share this post


Link to post
Share on other sites
Advertisement
That's kind of the way Euler angles work. However, I'm a little confused because the two symptoms you describe sound like they should be associated with different concatenation orders. Are you saying you get both of these symptoms with the same code, or that you tried switching your code around and get one symptom sometimes and the other symptom other times?

Anyway, I think the former case - where yaw seems like roll when you're heading straight up or down - is typical behavior for a simple flight simulator. However, it sounds like you may actually be wanting 6dof motion, in which case you'll have to ditch Euler angles and use incremental rotations instead. This may or may not be what you're looking for, but I posted code for 6dof motion in this thread some time ago.

Share this post


Link to post
Share on other sites
Quote:
Original post by jyk
That's kind of the way Euler angles work. However, I'm a little confused because the two symptoms you describe sound like they should be associated with different concatenation orders. Are you saying you get both of these symptoms with the same code, or that you tried switching your code around and get one symptom sometimes and the other symptom other times?


No, the problem is either - or, depending on whether I multiply the Y or X axis first.

Share this post


Link to post
Share on other sites
Quote:
Original post by jackharmon
No, the problem is either - or, depending on whether I multiply the Y or X axis first.
Got it. And yes, those are exactly the results you should expect with Euler angles.

Share this post


Link to post
Share on other sites
judging by your description, you have run into the problem commonly known as "gimbal lock". while a quick google query will releveal a lot of info on the subject the safest way to combat this unwanted effect is to use quaternions for your transformations.

Share this post


Link to post
Share on other sites
Quote:
Original post by benishor
judging by your description, you have run into the problem commonly known as "gimbal lock". while a quick google query will releveal a lot of info on the subject the safest way to combat this unwanted effect is to use quaternions for your transformations.
I'm curious, why is using quaternions safer (with respect to gimbal lock) than using matrices, axis-angle pairs, or direction vectors? Could you clarify?

Share this post


Link to post
Share on other sites
quoting "quaternions don't suffer from some of the problems associated with matrices and floating point math, eg after many matrix multiplications floating point inaccuracies result in a non-orthogonal matrix that has to be rebuilt."

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!