Archived

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

dabx11

Anyone Know Why this worked?

Recommended Posts

This is part of a skeletal animation system i''m working on where each joint has a relative vector(translation) and quaternion(rotation) from it''s parent. I was converting some data I exported out of 3D Max which use''s a right hand coordinate system (+z is up, +Y is away) to be used in DirectX (+y is up, +z is away). ok..no problem..switch the z and y for translation. now the part I don''t understand how it worked,rotation..I converted the quaternion by switching the z and y..converted to a rotation matrix..did a matrix transpose..then converted back to a quaternion. I did this by mistake, but it seems to work. What is the correct way to convert a quaternion from a right hand to a left hand coordinate system?

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
For quaternions describing rotations, you can treat it as a rotation around an arbitrary axis. x,y,z is the axis * sin(angle/2), w = cos(angle/2). By flipping the Y & Z, you are merely changing which axis you are rotating around. The transpose is required as a left handed system rotates the ''opposite'' way from a right handed system. You can optimize your Quat-to-Mat, Transpose, Mat-to-Quat by simply using the conjugate of the quaternion. I.E. newquat(-oldquat.x,-oldquat.y,-oldquat.z,oldquat.w) as this is the quaternions equiv. of a transpose.

Share this post


Link to post
Share on other sites