0
\$\begingroup\$

I have attached a capsule collider with my player(prefab) and made a script so that when Space key is down it does the jump animation in Unity. But because of the collider not jumping with the player, the player gets stopped by obstacles though he visually passed it. How can I make a collider that moves with my animations attached to a prefab?

\$\endgroup\$
1
  • \$\begingroup\$ Can you show us what your jump animation looks like? If it's a skeletal animation, you may be able to simply attach the collider to the character's hip bone or similar. For more complex cases, you might need to adjust the collider's size and offset or enabled state through animation curves. \$\endgroup\$
    – DMGregory
    Oct 6 '19 at 12:21
0
\$\begingroup\$

You can move the collider's transform but not with animation. To animate the collider, you can make a child object and assign collider component to that child object, then you can make an animation that moves the collider child object with aniamtion.

Otherwise you can disable APPLY ROOT MOTION from your animator component and let physics move it by AddForce()

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.