The wrong quarternion

Started by
1 comment, last by playtime222 13 years, 6 months ago
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.
Advertisement
Try:
Quaternion.Concatenate(q2, q1).
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.

This topic is closed to new replies.

Advertisement