
Rotations in IMVU or Cal3DA few simple rotations:No rotation at all
Rotation about the X axis
Rotation about the Y axis
Rotation about the Z axis
Combining rotationsThis is the difficult one: rotations are represented using a specialised form of complex number known as a quaternion. My best guess is that the number parts are meant to be read from right to left. If we call two rotations P (P3,P2,P1,P0) and Q (Q3,Q2,Q1,Q0) and the combination R (R3,R2,R1,R0) then to determine R we need R=P*Q R_{0}=P_{0}*Q_{0}P_{1}*Q_{1}P_{2}*Q_{2}P_{3}*Q_{3} For R_{1..3} R_{1}=P_{0}*Q_{1}+P_{1}*Q_{0}+P_{2}*Q_{3}P_{3}*Q_{2} R_{2}=P_{0}*Q_{2}+P_{2}*Q_{0}+P_{3}*Q_{1}P_{1}*Q_{3} R_{3}=P_{0}*Q_{3}+P_{3}*Q_{0}+P_{1}*Q_{2}P_{2}*Q_{1} Reversing or undoing a rotationYou can reverse the effect of a rotation by negating Q_{0} or negating Q_{1},Q_{2},Q_{3}, either one works. Multiplying the rotation by its reverse or "conjugate" yields "0 0 0 1" or "0 0 0 1". Note this is not the same as rotating the same joint in the other direction. Normalising or cleaning upThe values should be "normalised", that is to say they should satisfy Q_{0}^{2}+Q_{1}^{2}+Q_{2}^{2}+Q_{3}^{2}=1 If you start with normalised values you should finish with normalised values, but if you perform a lot of operations they may "drift" due to rounding.
