Hey Guys! I’m creating a game using the mecanim system. I want to change the y position of my capsule collider attached to the player during the jump animation. How can I do that?
I’m using a curve in my animation called ColliderPosition and I’ve also created a float parameter in the animator window. I’ve used the following code with the help of unity mecanim tutorial ofcourse. Just take a look and tell me if i’m doing something wrong.
if(stateInfo.nameHash == jumpState)
{
float colliderPosValue = anim.GetFloat("ColliderPosition");
capsuleCollider.center = new Vector3(0f,colliderPosValue,0f);
}
Please help. ThankYou.