Setting up UE4 Character jumps

The game I currently am working on is quite heavy on all kinds of jumps, so I dedicated some time to investigate how to configure UE4 character jumps properly. Some random values I put in Jumping / Falling section of Character Movement component did not work well for me:

A trajectory of some random UE4 character jump

I drew a trajectory of my jumps before I started tweaking the config values. You may notice that they are not symmetrical – the reason for that is the character (a lamp in my case) speeding up horizontally during a jump. This does not make sense for projectile motion.

Physics behind UE4 character jumps

Recently I watched a very good video from GDC conference. The speaker told about jumps in games and more important – physics behind jumps. I recommend you to watch this video first – I am going to use physics formulas of projectile motion which perfectly described in the video:

Surprisingly, UE4 character jumps fit common physics laws really good. And I will show you in the next section how to configure the settings properly, so the jumps become more predictable.

Symmetrical jumps

First, let’s make jumps symmetrical. I would like to get this out of the way before setting up anything else.

In my case, this happens because I use Add Movement Input node to move the character. The character speeds up horizontally with an acceleration which does not make sense for projectile motion – initial speed should be the maximum speed during the whole jump. I could not figure out how to turn off the acceleration, so I just put a huge number in Character Movement / General Settings / Max Acceleration value. 100000 should be enough:

Symmetrical ue4 character jumps
It’s symmetrical now

Jump height

In the video above there were two important formulas which describe speed and gravity dependency on height and time:

     \[ v_0 = \frac{2h}{t_h} \]


     \[ g = \frac{-2h}{t_h^2}  \]

where v0 is an initial vertical speed, h – jump height, th – time to reach the height, g – gravity

Note here, that only gravity and initial vertical speed can be configured in UE4 with the use of the following variables: gravity scale and jump Z velocity. Height and time depend on these variables.

Say you want a jump 100 cm height which takes 1 sec to complete. Then, gravity should be:

     \[ g = \frac{-2 * 100\:cm}{0.5\:sec^2}=-800\:cm / sec^2 \]

Or in terms of UE4, the gravity scale should be 0.8163. The vertical speed, on the other hand, should be:

     \[ v_0 = \frac{2 * 100\:cm}{0.5\:sec} = 400\:cm/sec \]

Let’s check if this math works:

Great! It works. Now, for my game I want gravity to be the same as on Earth, i.e. 980 cm/sec2. In such requirements, according to the first formula I either choose a time to reach the maximum height or a target height. I cannot configure both. Let’s say, I still need a 1 sec jump because it matches my jump animation. In this case, the target height will be:

     \[ h = \frac{-(-980\:cm/sec^2)*(0.5\:sec)^2}{2} = 122\:cm \]

And the speed:

     \[ v_0 = \frac{2 * 122\:cm}{0.5\:sec} = 488\:cm/sec \]


UE4 character jumps with a const gravity and variable time (set to 1 sec)

Jump distance

Let’s move on to jump distance settings. In the video there were again two formulas:

     \[ v_0 = \frac{2hv_x}{x_h} \]


     \[ g = \frac{-2hv_x^2}{x_h^2} \]

Where vx – horizontal speed and xh – distance to the jump peak. I use Add Movement Input to control the horizontal speed, so vx will match max speed UE4 variable. And xh is not configurable.

Let’s again check if this works at all. I want a 1 second jump and which is 120 cm length. I don’t change the initial vertical speed, but I adjust the horizontal speed:

     \[ v_x = \frac{v_0x_h}{2h} = \frac{488\:cm/sec*60\:cm}{2*122\:cm} = 120\:cm/sec \]

and the result:

As you see jumps in Unreal Engine 4 are highly configurable and likely you won’t need to implement a custom jump system.

Leave a Reply

Your email address will not be published. Required fields are marked *