How to stop CharacterMovement blueprint jumping from ledge

The stock 3rd person SideScrollerCharacter which comes with UE has a movement blueprint which allows some form of ledge detection, where the character may fall off a ledge. When allowed to do so, the blueprint first initiates a Jump state before falling, where not only is a z velocity component initiated, but also an additional horizontal component. Basically the character accelerates upwards and also forwards. I want to either: get rid of the horizontal (forwards) velocity component of the initiated jump function, or remove the function altogether when the character leaves a ledge, so instead, it drops off the ledge with no added velocity components and just falls due to gravity.

I have tried looking through the C++ code of the CharacterMovementComponent and cannot find the function where this is happening. Any help would be greatly appreciated.

I was just trying to solve this, and the solution was fairly simple.

You’re gonna need to create a bool in both your ThirdPersonCharacterBP, and the animiation blueprint found in Content>ThirdPersonBP>Animations>ThirdPersonAnimBlueprint called, has jumped

And you’re gonna see something like this. (Ignore the Ledge Grab and Sliding nodes, those don’t matter).

In the event graph of your AnimBP, you’re going to set the value of your AnimBP Has Jumped to the value of your ThirdPersonCharacter Has Jumped

117540-anim+bp+3.png

Next, click on that white line in between Idle/Run and JumpStart. We’re going to edit the transition rule that goes from idle to jump.

It defaults to say, if (is in air) -> Jump

Go back to player, and add this code:

When the player presses Jump, we’re going to set HasJumped to be true, then fire the jump event, then after an arbitrary delay, set it back to false. You can also set this as a custom event, so you don’t have to worry about messing it up.

If you were to try this right now, you’re player isn’t going to jump off the ledge when he falls off of it, but he doesn’t fall either. He is still in his running animation and looks frankly stupid. So, we need to create a transition between Idle/Run and JumpLoop

Pretty straightforward. If we’re in the air, but we haven’t jumped, then we must be falling.
And there you go! Cheers!

1 Like

Perfect solution!

Note that the cast in the animbp is a pure cast (right click your usual cast and select pure from the bottom of the list).

Cheers Willard720!

1 Like