In this tutorial, I’ll be going over how to create a Jump Pad in UE4. An object which will launch the player through the air when they step on it.
The process is relatively simple. First, create a blueprint actor, give it some sort of collision with overlap events, and give it an “ActorBeginOverlap” event node in the graph.
This will trigger the blueprint graph when an actor overlaps the jump pad.
Second, create a “Cast To” node directed at your player character, and connect it to your overlap event node with “Other Actor” plugged into the “Object”.
This will cause the rest of the graph to activate only when the player character is the actor overlapping the jump pad.
Third, create a “Launch Character” node and plug the value returned from the Cast node into its Target.
This will then launch the character into the air when stepping onto the jump pad.
The function of the Launch Velocity input is straightforward, but the other two inputs are used to remove any pre-existing velocity on the character. Say for example that you left the Z unlocked; dropping down onto the pad would cause you to not get launched as high because the new upward velocity is simply being added onto your downward velocity, whereas jumping up into the pad would cause you to be launched much higher. Locking the Z would cause you to always be launched the same height either way.
Now we can make this a little more complex.
Create a float variable named “Velocity”, compile, and expose it by clicking the eye icon.
This will allow you to determine the distance that the pad will launch the player by changing a single variable, and exposing it allows you to assign a unique variable amount to each jump pad that you place within a level.
Place the velocity variable within the graph. Because of the way velocity works, higher values will increase the distance the player moves exponentially. If you get the square root of the velocity variable, this will cause it to increase the distance traveled linearly. As an example, a value of 100 would launch you twice as far as a value of 50, whereas previously it may have launched you several times as far.
This will also cause the variable to have an exceptionally small influence, so you should multiply it after. If you multiply it by 443, this will cause a value of 1 to launch the player the same distance into the air as a default jump. A value of 5 would launch you 5 times the distance of a jump into the air. Also of note is that this equals 100 in game units of distance traveled, if the player is launched directly up.
From here, you’ll need to create a “Make Vector” node, and plug the result of of your variable into the Z axis.
You can then create a “Rotate Vector” node. Plug your vector into the A, and create a “Get Actor Rotation” node to plug into the B. This will cause the pad to always launch the player up within its own local rotation. So if you were to flip the pad sideways and stick it on a wall, it would launch the player sideways.
Once you have your final vector, you simply plug it into the Launch Velocity input of the Launch Character node.
If you want the pad to launch the player at an angle, you can take a similar approach to rotate the vector based on whatever arbitrary angle you wish. If you wanted the pad to launch the player over a gap or chasm for instance, you could rotate the vector in the Y(Pitch) by 45°. This would launch the player at a 45° angle, instead of directly upward.
Later I’ll write a tutorial on how to display a trajectory, which you could use to figure out the exact path the player would take when hitting the jump pad, and where they would land.