1
\$\begingroup\$

I have a character controller. I am primarily using FSM with the animations and blends. However, I am running into some trouble with the fall.

I walk up to a ledge and walk off...sometimes I will make it off the edge and the falling animation will play...but sometimes I get stuck halfway off the edge.

Also, the falling animation completely disregards any motion vectors I had prior to transferring to the falling state.

Is there a way to transition to fall, retaining the current x-y velocities?


In an effort to fix this, I tried giving the attached rigidbody a force vector slightly up and in the direction of travel so that the character gets a little hop over the edge...but again, no luck.

\$\endgroup\$
  • \$\begingroup\$ It might help to have a screenshot of how it's "stuck". If the player dies after this fall and respawns (the object is destroyed), you may want to consider moving it to another layer that won't collide, or disabling the physics on the player object during the fall. \$\endgroup\$ – Jesse Williams Jun 13 '16 at 17:07
  • \$\begingroup\$ @JesseWilliams The "sticking" isn't a problem. I just transition into the fall animation, then back again if the downward velocity stops increasing. The issue is continuing the motion of the character before the fall into the fall--so that instead of falling in a straight line, the character retains his momentum and falls in a parabola like real life... \$\endgroup\$ – donlan Jun 15 '16 at 13:06
  • \$\begingroup\$ If you're using the Unity physics engine, this shouldn't be an issue - though you may want to decrease horizontal velocity as vertical velocity increases to your gravitational norm (default 9.8). I'm not sure what it would look like, but you would probably want to decrease it by an inverse of the increase so that if/when vertical velocity hits 9.8, horizontal velocity reaches 0.0. \$\endgroup\$ – Jesse Williams Jun 15 '16 at 13:49
  • \$\begingroup\$ Actually, 9.8 is gravitational acceleration (sorry, still tired). But an inverse to maximum vertical velocity would still make sense. It would end up being a rather smooth curve, but should prevent any oddities where the object falls in an increasingly steep diagonal line. \$\endgroup\$ – Jesse Williams Jun 15 '16 at 13:51
  • \$\begingroup\$ @JesseWilliams I think it should be some sort of settings thing, because the thing is, the animation just falls in exactly a straight line down, according to gravity. So physics is only applied in the Y axis. The motion is generated with the root motion of the animation prior to the transition to the fall... \$\endgroup\$ – donlan Jun 15 '16 at 15:46

Your Answer

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

Browse other questions tagged or ask your own question.