Character Jumps when walking off ledge?


I followed the 3rd person template exactly and one thing I noticed is that if you walk off a ledge, 2 problems occur:

  1. On your way down (through air) the character plays the “jump” animation rather than going straight to the falling animation.

  2. Whilst falling, after walking off a ledge, if you press jump it will let you jump from any point in the air. Likely because the jump function in the CharacterBP sets a “jump count” variable from 0 to 1 depending on if you pressed jump or if you have landed. Since walking off a ledge is not a “jump” the “jump count” variable is obviously still at zero when walking off a ledge, thus allowing a jump at any time during the character’s fall.

How do I fix these 2 problems? I figure since it’s built into the template, a lot of other folks might be having this same problem but I can’t find anything on it. Hope someone on here has some magic! :slight_smile:

I haven’t used the 3rd person template, but I figure that in the character’s animation blueprint there is a state machine somewhere for the jump start-loop-end animations. It probably enters a state that plays the jump start animation when the character’s movement component “IsFalling()” function returns true. You should change the condition that goes from Walking -> Jump Start to: IsFalling() AND Velocity.Z > 0, so that state is only entered when you’re in the air and moving up, which is the case where you consciously jumped. And you should add a transition from Walking -> Jump Loop whose condition is IsFalling() AND Velocity.Z <= 0, so that the Jump Start state is skipped if your start a “jump” by falling.

As for point 2, you can do this in either C++ or blueprint. Override the Character’s CanJump function and add a condition that the character is moving on the ground. You can call the character movement component’s IsMovingOnGround() function. I haven’t tested this, but this should work or push you in the right direction. Posted a screenshot that illustrates my blueprint suggestion.