# How to stop CharacterMovement blueprint jumping from ledge

**URL:** <https://forums.unrealengine.com/t/how-to-stop-charactermovement-blueprint-jumping-from-ledge/378278>\
**Category:** Blueprint\
**Tags:** component-space, unreal-engine, UE4, CPP, Blueprint, question\
**Created:** [December 4, 2016, 4:43pm UTC](https://forums.unrealengine.com/t/how-to-stop-charactermovement-blueprint-jumping-from-ledge/378278 "2016-12-04T16:43:00Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mdcw9](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@mdcw9](https://forums.unrealengine.com/u/mdcw9)\
**Post date:** [December 4, 2016, 4:43pm UTC](https://forums.unrealengine.com/t/how-to-stop-charactermovement-blueprint-jumping-from-ledge/378278/1 "2016-12-04T16:43:00Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Willard720](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Willard720](https://forums.unrealengine.com/u/Willard720)\
**Post date:** [December 6, 2016, 6:26am UTC](https://forums.unrealengine.com/t/how-to-stop-charactermovement-blueprint-jumping-from-ledge/378278/2 "2016-12-06T06:26:16Z")

</div>

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`

 ![117538-anim+bp.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/d/b/5/db5d9ed0c60bf7cefd9df0e56159ce86de15001c.png)

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](https://d3kjluh73b9h9o.cloudfront.net/original/4X/5/3/0/5307160d7b715b45831c3ade2f77c4115324ace8.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`

 ![117539-anim+bp+0.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/0/0/f/00ffebfa718a6844e9e22521b9fb2d4cbc0b9d92.png)

Go back to player, and add this code:

 ![117551-jump+press.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/4/8/3/483bd87f05c5657f592bd7d3b5abea7cd58c29bc.png)

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`

 ![117552-anim+bp+2.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/1/d/b/1db85c2671037780e993be32392754c7ab5f1ca1.png)

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

---

<div class="post-metadata">

**Author:** ![Valkyrie\_Sound](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Valkyrie\_Sound](https://forums.unrealengine.com/u/Valkyrie_Sound)\
**Post date:** [October 30, 2018, 9:41am UTC](https://forums.unrealengine.com/t/how-to-stop-charactermovement-blueprint-jumping-from-ledge/378278/3 "2018-10-30T09:41:12Z")

</div>

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!
