How to derive euler angles from matrix or quaternion?

Posted by KlashnikovKid on Game Development See other posts from Game Development or by KlashnikovKid
Published on 2012-09-03T17:36:23Z Indexed on 2012/09/03 21:49 UTC
Read the original article Hit count: 283

Filed under:
|
|
|

Currently working on steering behavior for my AI and just hit a little mathematical bump.

I'm in the process of writing an align function, which basically tries to match the agent's orientation with a target orientation. I've got a good source material for implementing this behavior but it uses euler angles to calculate the rotational delta, acceleration, and so on. This is nice, however I store orientation as a quaternion and the math library I'm using doesn't provide any functionality for deriving the euler angles. But if it helps I also have rotational matrices at my disposal too.

What would be the best way to decompose the quaternion or rotational matrix to get the euler information?

I found one source for decomposing the matrix, but I'm not quite getting the correct results. I'm thinking it may be a difference of column/row ordering of my matrices but then again, math isn't my strong point. http://nghiaho.com/?page_id=846

© Game Development or respective owner

Related posts about math

Related posts about matrix