Opening Doors

Choose your OS:

An example use of a timeline in which we set up a classic proximity-based opening door.

Level Setup

The level begins with a simple door. This door is surrounded on both sides by a single Trigger Volume. As players enter and exit this trigger volume, we will execute the timeline which will open and close the door.

DoorLevelSetup.png

Blueprint Setup

Here you can see the Blueprint network that powers this behavior.

We start by storing the door's current location into a vector variable we named "Door Initial Location." Since - unlike Matinee - Timelines do not do this automatically, we need access to that data so that we can add it to the motion for raising the door.

Once we have done that, we can set up the timeline itself. In this case, the timeline is called by 2 different events, both of which stem from the trigger volume. When the player touches the volume, we play the timeline's animation, which raises the door. This is done by adding the curve value from the timeline to the original position, stored at the beginning of the level.

When the player exits the volume, we wait 2 seconds and then play the timeline in reverse, bringing the door back down.

Click for full size

Note that sound effects are not considered in this setup.

Timeline Setup

The timeline setup for this example is fairly simple. We have a single Vector curve in place. In this curve, we have animated the Z component to go from 0,0 to 1,360. This means that we are moving the door upward 360 units over the course of a single second.

DoorTimeline.png

Tags