Can I copy moves from one animator to another using Mecanim?
So I want to copy every bone move from one humanoid character to another. When first one is playing some animation, another will exactly mimic animation. Is this possible? I guess it is, but:
public class CopyAnimatorMoves : MonoBehaviour
{
public Animator Target;
private Animator _animator;
private void Start()
{
_animator = GetComponent<Animator>();
}
private void OnAnimatorIK(int layerIndex)
{
foreach (HumanBodyBones bone in Enum.GetValues(typeof(HumanBodyBones)))
{
if (bone == HumanBodyBones.LastBone)
{
continue;
}
Transform targetBone = Target.GetBoneTransform(bone);
if (targetBone != null)
{
_animator.SetBoneLocalRotation(bone, targetBone.localRotation);
}
}
}
}
Is not working, skeletons have diffrent angles on bones, so result is just creepy. But animations created through Mecanim system are working nice, so this is possible to achieve mirror moves. Any ideas how?
Comment