I’ve made a simple moving platform in Unreal Engine today. This is used in platform games all the time, be it as a triggered mechanism or an automatically moving always-looping/moving thing. Remember all those gaps you need to cross over a deep ravine, while stone platforms are moving left and right, and you’ll have to jump over them and make sure you don’t die? Yeah, those are the ones. I’ll show you how to make one of these in Blueprint.
With a new Actor Blueprint, I’ll add any type of object that will serve as my moving platform. A squashed cube will do, or anything more fancy if you wish. I found the platform above in the Synty Sci-Fi City Assets. It needs to be movable rather than static, otherwise Unreal Engine will throw an error message as it’s trying to animate it.
In the Event Editor, I’ll hook into Event BeginPlay for an always-moving platform. It’ll be different for a platform that is triggered as a result of a player’s action. Any trigger will do to kick off the yellow Timeline Node. I’ve called mine Elevator, and here’s how it’s hooked up:
The Height parameter drives the Z Location of our platform (referenced as Target). The real magic is happening inside the Timeline Node though, so let’s have a look at that:
Here we have a vector track I’ve named Height. It’ll be accessible as a pin on the node, as seen in the previous screenshot. There are five keyframes on this track (creatable by right-clicking), interpolating the output value between 0 and 800, and leaving a plateau at the top and bottom so the platform waits for the player to step on/off.
The sequence will auto-play and loop indefinitely. Adjust as necessary. Here’s what it looks like in the game:
Any questions? Please let me know below!