Jump to content
  • Advertisement
Sign in to follow this  

The wrong quarternion

This topic is 2916 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

A flight model issue:

The space ship has orientation q1. The flight controls cause yaw y, pitch p and roll r which give q2 = Quaternion.FromYawPitchRoll(y,p,r).

A simple visual test applying just yaw to several randomly oriented spaceships made each space ship rotate around the world y axis regardless of orientation when using Quaternion.Concatenate(q1, q2).

So I've missed something - q2 is relative to world coordinates not the current orientation of the given spaceship.

I need to something to q2 so that it's relative to the space ships current orientation not the world axis, then apply it to q1 to get the new orientation.

Can someone supply the correct line of code or the operations I need to do to q1 and q2, please?

Thanks in advance.

PS. Using XNA4.

Share this post

Link to post
Share on other sites
Several things:

Most importantly, thanks very much, it worked.

Secondly, I can't believe I didn't try that myself when I know the operation isn't commutative.

That'll teach me to code after midnight on a work day - too tired to think.

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!