1.1 - Trigger Box

An overview of the Level Scripting example level, example 1.1: Trigger box used to open a door

Windows
MacOS
Linux

levelscripting_1_1.png

A Trigger Box Actor is placed in front of a Blueprint containing a set of doors. When the player touches the trigger box, the doors open, and when the player exits the trigger box, the doors close. The door Blueprint contains all the necessary script for animating connected to custom events, which the level script can call.

Level Script

LevelScript_1_1_LS.png

When provided with a reference to a Blueprint Actor, seen here as the small blue variable node, the level script can call any custom events inside that Blueprint, as well as binding events within the level script to certain conditions. In this case, we use overlap events, which fire when the player enters and exits the Trigger Volume (green box surrounding the door). Once these are fired, we trigger the corresponding custom events on the BP_Double_Doors Blueprint Actor.

BP_Double_Doors Event Graph

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

The BP_Double_Doors Blueprint Actor contains a setup for a somewhat sophisticated door. You can see how the Timeline is used to drive several things, including the location of each door, the rotation of the bolt mechanism, and the Material applied to the bolt. The network is fired whenever the Blueprint receives the Open Doors or Close Doors events, which are custom events created for this Blueprint.

Select Skin
Light
Dark

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