3
\$\begingroup\$

What's the general solution to the following character animation problem (I'm using Unity)?

You have a character with a capsule collider and a jump animation that allows you to jump onto higher ground (such s boxes, etc.). The character shouldn't be able to jump unrealistically high so she goes into a crouched posture while in the air and the collider is scaled accordingly in an animation curve.

However when the character jumps onto the box to land, the character animation (and collider) want to extend back to wards the ground but there is not enough space and either collision detection fails and the character falls into the geometry or the collider starts a collision fight with the box and keeps bumping up and down, keeping the character in an airborne state.

Please see screenshots to get a better idea...

enter image description here enter image description here enter image description here

What would be a good way to work around this problem?

\$\endgroup\$

1 Answer 1

1
\$\begingroup\$

It seems like you are missing to move the transformation of the player high enough. like on the picture I think the problem is, that you set a jump height according to the animation and not to the player without animation. So jump height looks fine when in crouch position, but when u turn of the animation, you will see, that the player model jumps way to less high.

I think this is your problem. So just fix the jump height and all will be fine.

As a side node, an animation should allways be applied only, when the actual movement is ok.

So in your example, only when the player model jumps correctly to its complete transformation, then apply an animation for the whole duration of the jump.

\$\endgroup\$
3
  • \$\begingroup\$ Ok, that would probably work but what if the player shouldn't jump that high, i.e. keeping jump height relatively realistic? Because unrealistically high jumps is what I'd like to prevent. \$\endgroup\$ Commented Nov 11, 2015 at 10:39
  • 1
    \$\begingroup\$ Then if u want that jump behavior as u have, u have to transform the origin of the object after landing. U see the red dot of the object. That's it's origin. You need to adjust it after landing. \$\endgroup\$ Commented Nov 11, 2015 at 11:21
  • \$\begingroup\$ Thanks for the tip! I will be looking into adjusting the origin coordinate. \$\endgroup\$ Commented Nov 12, 2015 at 5:17

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .