lsalzman / iqm

Inter-Quake Model format development kit
MIT License
239 stars 73 forks source link

Meaning of rotation value for a bone pointing up? #19

Open roxlu opened 8 years ago

roxlu commented 8 years ago

I'm not sure if this is an issue; it probably isn't but I'm trying to find out a certain value that I get from a very simple model. When I create a cube and one bone which points up into the (blender) Z-axis the rotation value I read from the .iqm file is -0.71, -0.00, -0.00, -0.71. This looks like a rotation about the X axis but a +90º rotation should be: 0.707107, 0.000000, 0.000000, 0.707107 and a -90º rotation should be -0.707107, -0.000000, -0.000000, 0.707107. Maybe I'm lacking some quaternion know-how, or maybe it's a different rotation. Could you maybe clarify this?

This is the model I'm using:

lsalzman commented 8 years ago

Quake convention is that quaternions are always represented with -w.

On Wed, Jan 20, 2016 at 5:44 PM, @roxlu notifications@github.com wrote:

I'm not sure if this is an issue; it probably isn't but I'm trying to find out a certain value that I get from a very simple model. When I create a cube and one bone which points up into the (blender) Z-axis the rotation value I read from the .iqm file is -0.71, -0.00, -0.00, -0.71. This looks like a rotation about the X axis but a +90º rotation should be: 0.707107, 0.000000, 0.000000, 0.707107 and a -90º rotation should be -0.707107, -0.000000, -0.000000, 0.707107. Maybe I'm lacking some quaternion know-how, or maybe it's a different rotation. Could you maybe clarify this?

This is the model I'm using:

https://camo.githubusercontent.com/82e9bb75d2b5d1b7b4a4ac2741c5eeeaf7a21385/687474703a2f2f692e696d6775722e636f6d2f5268656e7135362e706e67

— Reply to this email directly or view it on GitHub https://github.com/lsalzman/iqm/issues/19.

roxlu commented 8 years ago

Thanks lsalzman, do you maybe know if a -w has a special meaning regarding rotations? (sorry I guess I'm lacking some quaternion-know-how)?

And so... the -0.71, -0.00, -0.00, -0.71 I read from the .iqm file that I created from the bone as shown in the image, is a -90º rotation arount the X-axis. I'm wondering why it's a negative rotation instead of a positive?

Thanks!

z-adams commented 3 years ago

For posterity, the reason behind this is that Blender bones are oriented along the Y Axis, not the Z axis. A bone pointing straight up must thus be rotated about the X axis to be oriented straight up and down. Turning on the axis display under Armature > Viewport Display will display a set of axes at the origin of each bone which may help with debugging.

Negating all components of the quaternion has no effect on the rotation as there are two quaternions that redundantly describe each unique orientation. Just a side effect of the mathemagical SU(2) double covering of SO(3).