For testing purposes, I have swapped out my quadruped and replaced it with a simple cube animation fbx going from world 0,0,0 to say 0,0,1 and have 2 bones for root motion purposes. I have followed (more or less) the target matching example scene provided by Unity. I have also created an empty object called “target” so that instead of just moving to 0,0,1, it would move and rotate to the target’s position + orientation. I have attached the script and the target matching line to the cube:
// Update is called once per frame
void Update () {
if(animator) {
animator.MatchTarget(target.position, target.rotation, AvatarTarget.Root, new MatchTargetWeightMask(new Vector3(1,1,1), 1), 0f, 1f);
}
}
Nothing works apart from the animation going towards the Z axis and not the target. Any idea what could be wrong with it? Does target matching works with a generic rig?
@TitaniumBrendan Sorry my bad I didn’t read the whole thread, but since this question is about generic rig then yes in this case it expected that it will only work for the root
@Mecanim-Dev So is there any other way to do target matching on generic rigs with other bones than root?
as far as I could find out, its not even possible to look at an animaiton clip and extract the bone rotations at a certain time, and then calculate the transform matrices myself.