MarioFrost
12-12-2007 18:11:40
I think there's a bug in the function (NxOgre::Body*)->getGlobalOrientation().
I have compare this function with the one from OGRE, (Ogre::SceneNode*)->getWorldOrientation(); while I rotate a NxOgre::Body.
The bug seams to appear near the inversion of the signs in the quaternions.
Quaternion q1 = (NxOgre::Body*)->getNode()->getWorldOrientation();
Quaternion q2 = (NxOgre::Body*)->getGlobalOrientation();
OUTPUT : ([q1] [q2])
When you use NxOgre Orientation, you perform conversion to Axes and finally to Quaternion and you don't get the same Quaternion values! :
and the output:
The axes are the same but the quaternions are inverted. It looks like the value form (NxOgre::Body*)->getGlobalOrientation() is not a valid quaternion for Ogre...
any ideas?
thank you for you help!
I have compare this function with the one from OGRE, (Ogre::SceneNode*)->getWorldOrientation(); while I rotate a NxOgre::Body.
The bug seams to appear near the inversion of the signs in the quaternions.
Quaternion q1 = (NxOgre::Body*)->getNode()->getWorldOrientation();
Quaternion q2 = (NxOgre::Body*)->getGlobalOrientation();
OUTPUT : ([q1] [q2])
...
[0.773489 0 -0.633809 0] [0.773489 0 -0.633809 0]
[0.715037 0 -0.699086 0] [0.715037 0 -0.699087 0]
[0.664299 0 -0.747467 0] [0.6643 0 -0.747467 0]
[0.610297 0 -0.792173 0] [0.610297 0 -0.792173 0]
[0.538608 0 -0.842557 0] [0.538608 0 -0.842557 0]
[-0.478252 0 0.878223 0] [0.478252 0 -0.878223 0] <<<<< q1 dot q2 = -1
[-0.415545 0 0.909572 0] [-0.415545 0 0.909572 0]
[-0.334327 0 0.942457 0] [-0.334327 0 0.942457 0]
[-0.267474 0 0.963565 0] [-0.267474 0 0.963565 0]
[-0.182098 0 0.98328 0] [-0.182098 0 0.98328 0]
[-0.112758 0 0.993622 0] [-0.112758 0 0.993622 0]
...
When you use NxOgre Orientation, you perform conversion to Axes and finally to Quaternion and you don't get the same Quaternion values! :
Vector3 u[3];
Vector3 v[3];
// Conversion from Quaternion Q1 to Axes U
// [0.517589 0 -0.855629 0]
Quaternion q1 = Quaternion(0.458079, 0, -0.888912, 0); // Value from (NxOgre::Body*)->getGlobalOrientation();
q1.normalise();
q1.ToAxes(u);
// Conversion from Axes U to Quaternion Q2
Quaternion q2 = Quaternion(u);
// Conversion from Quaternion Q2 to Axes V
q2.ToAxes(v);
// Dot product
Real dot1 = q1.Dot(q2);
and the output:
QUAT q1 [0.458079 0 -0.888912 0]
VECTOR u x[-0.580328 0 0.814383]
VECTOR u y[-0 1 0]
VECTOR u z[-0.814383 -0 -0.580328]
QUAT q2 [-0.458079 0 0.888912 0]
VECTOR v x[-0.580328 0 0.814383]
VECTOR v y[0 1 0]
VECTOR v z[-0.814383 0 -0.580328]
q1 DOT q2 [-1]
The axes are the same but the quaternions are inverted. It looks like the value form (NxOgre::Body*)->getGlobalOrientation() is not a valid quaternion for Ogre...
any ideas?
thank you for you help!