I asked around in tge Ogre 3D forum how it's done there. I seems that the quaternion multiplication order differs from ogre and sharp dx (atleast is seems that way), I have asked on their forum. In ogre the multplication order is right to left.
in the XNA documentation is say the product of a quaternion multiplication = Q2 * Q1, e.g right to left.
any ways, my code for rotating in the desired transform space :
case TransformSpace.Parent: relativeOrientation = relativeOrientation * q; break; case TransformSpace.World: relativeOrientation = WorldOrientation * q * worldOrientationInverse * relativeOrientation; break; case TransformSpace.Local: relativeOrientation = q * relativeOrientation; break;
Now, the order of multiplication here is the reverse of what ogre is using.
When I send the worldmatrix to the shader I have to transpose it, Sharp DX use row major and the HLSL shader expect matrices as column major. So I transpose the world matrix before sending it to the shader.
Is this why I must reverse the order?