2.4 - Door With Trigger

An overview of the Advanced Blueprints example level, example 2.4: Door With Trigger

Windows
MacOS
Linux
On this page

blueprint_advanced_2_4.png

The BP_Door Blueprint creates a door that opens with a trigger Box Component, and is another example of a Blueprint that might commonly be used in the creation of a game, with script and animation built in that needs no additional setup.

When a player touches the BoxComponent, the Blueprint retrieves the player's location relative to the door and uses this information in conjunction with the Actor's rotation to determine which side of the door the player is on. Then, a Timeline plays that opens the door in the correct direction, so that it swings away from the player.

Event Graph

Click for full size or right-click and Save As.

This Blueprint employs two Timelines: one for opening the door, and one for closing it. When the player first overlaps the Box Component, the Open direction Boolean variable is set depending on which side of the door the player is on. Next, the timeline for opening the door plays. The timeline is connected to a Lerp (Rotator) node, which linearly interpolates between the starting rotation and the desired final rotation. A Select Float node selects the correct final rotation based on the value of Open Direction. This way, the same timeline can be used to open the door in either direction.

Welcome to the new Unreal Engine 4 Documentation site!

We're working on lots of new features including a feedback system so you can tell us how we are doing. It's not quite ready for use in the wild yet, so head over to the Documentation Feedback forum to tell us about this page or call out any issues you are encountering in the meantime.

We'll be sure to let you know when the new system is up and running.

Post Feedback