I'm having a bit of difficulty getting my head around some Quaternion math. I have two skeletons, but the joints differ in orientation, e.g. One shoulders 'up vector' is (0,1,0), and the shoulder on the other skeleton's 'up vector' is (1,0,0).
So the problem is that I want to copy the exact pose from one skeleton to the other. But the rotations don't match. What I have so far is
Quaternion ProcessRot(Quaternion InitialCloneRotation, Quaternion Destination, Quaternion InitialDestinationRotation)
{
return (InitialCloneRotation) * Quaternion.FromToRotation(InitialDestinationRotation * Vector3.forward, Destination * Vector3.forward);
}
Where InitialCloneRotation is the clones initial bone rotation in worldspace
Destination is the current bone rotation of the original skeleton in worldspace
And InitialDestinationRotation is the original skeletons initial bone rotation in worldspace
But all the rotation directions are still wrong.
I've also tried
return (InitialCloneRotation) * (Quaternion.Inverse(InitialDestinationRotation) * Destination);
I thought because all rotations passed are in the world space i should be able to get the relative worldspace rotation, irregardless of how the bones are orientated?
I can't change the bones as I am trying to transfer kinect movement to my skeleton that already has many animations already made for it.