- Home /
Animator MatchTarget Problem
Hey guys, I've started using mecanim in Unity recently and was looking to create a basic 3rd person game where the player can run, jump, swing and climb onto buildings (like Assasins Creed). I am using the free mocap data from the Asset store for my character.
I'm playing a jump and climb animation when a button is pressed and want to use the matchtarget command to match the player's hand to the ledge he's climbing on. This is the code I'm using:
if(Input.GetButtonDown("Jump")){
anim.SetBool("idle2ToDeath",true); //plays climb animation
anim.MatchTarget(jumpTarget2.transform.position, jumpTarget2.transform.rotation, AvatarTarget.RightHand, new MatchTargetWeightMask(new Vector3(0,1,0), 0f), 0.3f, 0.4f);
}
jumpTarget2 is a gameobject placed on a ledge for the player to cling onto while climbing up. The problem is, when I use the code above, it plays the animation and then the character instantly moves to a weird position. My problem is, 1. there's no blending or smoothness in the move of the player and 2. the player's hand isn't moving to the position I've set.
I've spent ages trying to fix this. If anyone could point out what I'm doing wrong or suggest and alternative way for limb placement in the scene I'd really appreciate it. Thanks!