# Coordinated PITCH and YAW rotation?

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

## 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 on other sites
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 on other sites
Great - will give it a shot! Thanks!

##### Share on other sites
Quote:
 Original post by jykThat'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 on other sites
Quote:
 Original post by jackharmonNo, 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 on other sites
Okie then - will try to convert it to DirectX.

Any gotchas I may encounter?

Thanks again!

##### Share on other sites
Got it working! I just studied what ya did and incorporated it into my existing setup.

Thanks again!

##### 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 on other sites
Quote:
 Original post by benishorjudging 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 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."

1. 1
Rutin
35
2. 2
3. 3
4. 4
5. 5

• 12
• 14
• 9
• 9
• 9
• ### Forum Statistics

• Total Topics
633340
• Total Posts
3011422
• ### Who's Online (See full list)

There are no registered users currently online

×