• ### What is your GameDev Story?

#### Archived

This topic is now archived and is closed to further replies.

# quaternion/euler angle rotation

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

## Recommended Posts

Where can I find a reference on how to do basic conversions from one position to another? I want to know how to do the "typical" 3D spaceship that can roll and yaw (bank) in a turn while simultaneously pitching up or down. I need to know how to go from one position to another. I realize Euler angles have the whole gimbal lock problem but I just don''t understand quaternions. Where is a good place to figure this stuff out? Thanks.

##### Share on other sites
Most people say the best book on the subject is Jack Kuipers "Quaternions and Rotation Sequences". It describes this from the ground up. I highly recommend it.

But basically you can forgo the Quaternions and build a rotation matrix by tracking the current yall, pitch and, row for your ship. Then using these angles to build a rotation matrix by multiplying the yall rotation matrix (done about the up axis), by the pitch rotation matrix (done about the right axis) and, by the roll rotation matrix (done about the look axis). The order of the rotations does not matter.

Or you can keep track of the three current look, up, and right axises for the ship and rotate the current delta yall, pitch, roll rotations about these arbitrary axises.

For either of these methods I suggest keeping each of the rotation angles between -180 degrees (-PI) to 180 degrees (PI) where zero is no rotation. This will keep things simple.

Gimbal lock will not be a problem if you do it like this.

Hope this helps.

##### Share on other sites
quote:

But basically you can forgo the Quaternions and build a rotation matrix by tracking the current yall, pitch and, row for your ship. Then using these angles to build a rotation matrix by multiplying the yall rotation matrix (done about the up axis), by the pitch rotation matrix (done about the right axis) and, by the roll rotation matrix (done about the look axis). The order of the rotations does not matter.

Hmm, is that true? From matrix algebra I remember that matrix multiplication is not....commutative? I mean, AB is in general not the same as BA, but is it in this case?

/Mankind gave birth to God.

##### Share on other sites
AB != BA, but (AB)C == A(BC).

##### Share on other sites
BeerHunter's hit it 100%.

Even though generally in matrix algebra AB != BA, the reason I say the order of the rotations don't matter is that for matrix rotations the order doesn't matter (At least for rotations on that anises that are orthogonal (perpendicular) -- like just on the X, Y, or Z axises. I'm not 100% sure if this is true for arbitrary rotations about any vector, but I think this property is true for those types of rotations also.) This is because of the unique properties of rotation matrixes. The proof for this is a bit much for me to go into here. but, the reason is explained quite well in that Quaternion book -- as it applies to Quaternions that is.

Mike

Edited by - blackbot20 on October 5, 2001 5:04:08 PM

Edited by - blackbot20 on October 5, 2001 5:04:59 PM

• ### What is your GameDev Story?

In 2019 we are celebrating 20 years of GameDev.net! Share your GameDev Story with us.

(You must login to your GameDev.net account.)

• 15
• 9
• 11
• 9
• 9
• ### Forum Statistics

• Total Topics
634131
• Total Posts
3015725
×