When rotating a shape using a quaternion value I also wish rotate its child shape.
The parent and child shapes both start with different orientations but their relative orientations should always be the same.
How can I use the difference between the previous and current quaternions of the parent shape in order to transform the child segment and rotate it relative to its parent shape?
public Quaternion Orientation { get { return entity.Orientation; } set { Quaternion previousValue = entity.Orientation; entity.Orientation = value; // Use the difference between the quaternion values to update child orientation } } EDIT:
If I have understood teodron correctly then this is what I must do
// Qc' = Qp' * Inv(Qp) * Qc // // Where: // Qp = Parent orientation last frame // Qp' = Parent orientation this frame // Qc = Child orientation last frame // Qc' = Child orientation this frame set { Quaternion previousValue = entity.Orientation; entity.Orientation = value; Quaternion childOrienation = value * Quaternion.Inverse(previousValue) * childOrientationPrev; //Quaternion newOrienationchildOrienation = childOrientationPrev * Quaternion.Inverse(previousValue) * value; } I have tried both multiplication orders but neither method rotates the child object correctly and instead it spins very quickly.