Current problem:
I'm using world space quaternion offsets to rotate a player model's hands to the player's true hands using:
private Quaternion GetOffsetFromAvatar(Quaternion a, Quaternion b)
{
Quaternion _offset = a * Quaternion.Inverse(b);
return _offset;
}
then applying it with:
public void OffsetTarget(Transform Target, Transform PlayerHand, Transform AvatarBone)
{
/// OffsetTarget() is to be used to auto align avatar hands to player hands.
Quaternion _offset = GetOffsetFromAvatar(PlayerHand.rotation,
AvatarBone.GetComponentInChildren<AvatarOffsetPoint>().transform.rotation);
Target.rotation = _offset * PlayerHand.rotation;
}
The expected result should allow players to change their model on the fly during runtime and the hands align correctly to the player's real hands, but when I test that, the hands face in completely different directions.