- Home /
Mecanim MatchTarget & Generic Rig
Working on a project where we are using mecanim to drive most of our NPC's movement, but want to be able to control the Y position of the character's via a c# script. From the Mecanim tutorial video, using MatchTarget seems to be the trick, but I'm unable to get it working. The line of code we are using is as follows:
myAnimator.MatchTarget(Vector3.up * targetHeight, Quaternion.identity, AvatarTarget.Root, new MatchTargetWeightMask(Vector3.one, 0), .1f, .5f);
As you can see, we're trying to use the match target in a very similar way to the tutorial video, but instead of using a hitPoint on the ground we're using a Y position we are calculating as Vector3.up * targetHeight
. Still, the NPC isn't moving at all along its Y axis and I've become a bit stumped.
The one nuance I can comment on is that the NPC is using the Generic mecanim rig, not the humanoid. Would this make a difference? Would using a non-humanoid rig make MatchTarget not work? If so, what would be the best alternative? If not, what am I doing wrong?
Answer by Mecanim-Dev · Jun 05, 2013 at 02:27 PM
Target Matching only work with Humanoid rig for now.
Your answer
Follow this Question
Related Questions
I can't setting at once ModelImporter.sourceAvatar in script. 1 Answer
How to animate a model that doesn't have arms or legs (just feet and hands) 1 Answer
What happens to Blender IK bones in Mecanim? 2 Answers
Humanoid fingers not deforming properly 1 Answer
Mecanim: Importing raw rigs with no mesh and only animation data? 0 Answers