Unreal Engine 4: Lifts and moving platforms

Unreal Engine 4: Lifts and moving platforms

Lifts and moving platforms are an essential part in making platformer games, or any game at all. And, it is really important because a game with just static objects would be really boring, so you definitely need moving objects, platforms, etc.

Creating a lift blueprint


To create a basic lift, let’s first create a class blueprint called LiftBlueprint, which will be the blueprint for the button that will activate the lift. The lift itself will be given as a parameter to the button actor.

I want to make the button a sphere, so I added a sphere mesh to the BP, and made it the root (drag the mesh component onto the root object to make the mesh root), then I added the Green_3 material from the post on material instances to the sphere mesh.

The Components and Viewport tabs should look like this at the end of this process:

Construction script (set speed of the lift)

Now that we have added the mesh and the material, let’s get into the actual script. For the movement, I am going to use a timeline called “Transition”:


and in the construction script I am going to set play speed to original play speed divided by the arrival time variable so that the total play time will equal the arrival time:


Moving the lift

Now that that’s done, let’s do the part where we move the lift. For this, I have planned a head and I have created two variables, “State” (0: at start, 1: moving, 2: at end; This variable is for debugging) and “Direction” (-1: backwards, 1: forwards). I want to set the state to 1 on hit, and also set the direction to 1 if the direction was -1, and set to 1 if direction was 1. Then, I want to attach those branches to play and reverse respectively. Here is the result:


Now, I want to Lerp from the starting vector to the ending vector, the alpha being the output of the transition. The location of the lift will be set to the output of the Lerp on Transition update. When the Transition is finished, the state and directions will be set as so:


Take your time, and understand what this part of the BP does, as it is fairly complicated.

Setting the lift up

To use the lift blueprint; first create a lift actor, I personally like to use SM_AssetPlatform. Then, drag the lift button blueprint into the level, and assign the lift actor, the end point and the speed, and there you have it, a working lift!

One of the benefits of using a timeline for this task, is that when the lift is in the middle of moving, you can reverse the direction from where it left off! Also, it is much easier to accomplish a task like this with a timeline. About two moths ago, I made a blueprint for moving platforms. It was so big and complicated, that you had to make the zoom -3 to fit it into a 1080p monitor! But like this it is much easier and simpler.

Oh, and stay tuned this weekend for a bonus post about this topic containing 5 bonuses!

To finish off this post, here is a picture of the full BP: Take care!


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s