Sign in to follow this  

The wrong quarternion

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

This topic is 2631 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this