Jump to content
  • Advertisement
Sign in to follow this  
david_watt78

Yaw + Pitch = Roll

This topic is 3171 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 am currently coding a space sim and have found that anytime you rotate a Quaternion in the Yaw axis and in the Pitch Axis at the same time you also get a Roll Rotation. Is there anyway to avoid this? I am doing my Rotations in the order Roll,Pitch, then Yaw, but it doesn't help. I have seen the same issue in some games as well. Is this a product of using Quaternions or is it a nature of the beast issue?

Share this post


Link to post
Share on other sites
Advertisement
That depends on what you mean by "you also get a roll rotation". Can you give an example of a set of angles to yaw and pitch which produce a roll? Also, when you say your ordering is "roll, pitch, then yaw", is that world-space order or object-space order?

Share this post


Link to post
Share on other sites
If you get the same results then you're definitely doing it wrong (read: in an order-independent way). Y-then-P and P-then-Y should NEVER produce the same results. Post your code.

Share this post


Link to post
Share on other sites
Quote:
I have tried yaw then pitch and pitch then yaw same results.
If you're building your orientation using 'from scratch' Euler angles in the usual way, then one of the above orders should be giving you the desired results (i.e. no roll). Can we see some code?

Keep in mind that with true 6DOF motion (where rotations are applied incrementally about the object's local axes), accumulated yaw and pitch can (and usually will) result in perceived roll. This is the expected behavior in this case, but it can be countered by adding an 'autoleveling' feature (as in the Descent games).

Share this post


Link to post
Share on other sites
Here you go. I would love to find an answer to the roll induction issue. I hope this helps.


CISQuaternion Temp = *this;
if(dRoll != 0.0)
{
CISQuaternion Roll;
Roll.FromAngleAxis(dRoll, Temp * CISVector::s_UNITZ);
*this = *this * Roll;
Normalize();
}
if(dYaw != 0.0)
{
CISQuaternion Yaw;
Yaw.FromAngleAxis(dYaw,Temp * CISVector::s_UNITY);
CISQuaternion Temp = *this;
*this = *this * Yaw;
Normalize();
}
if(dPitch != 0.0)
{
CISQuaternion Pitch;
Pitch.FromAngleAxis(dPitch,Temp * CISVector::s_UNITX);
CISQuaternion Temp = *this;
*this = *this * Pitch;
Normalize();
}

Share this post


Link to post
Share on other sites
How is this function used? Do you start with a 'fresh' quaternion each time (i.e. identity), or do you start with a quaternion representing the current orientation of the object?

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!