Choose your operating system:
Windows
macOS
Linux
In the following steps, we are going to create a simple door that opens/closes when entering/exiting a trigger volume.
Creating the Project
In this section, we will set up the project.
-
From the Unreal Project Browser window, create a New Project and use the Blueprint Third Person template.
-
Make sure that Include starter content is enabled.
-
Give the project a name.
-
With each of the above defined, click Create Project to create a new project.
Placing the Door and Trigger
In this step, we will place the door and add the trigger for the door.
-
Inside the Content Browser , find and select the Props folder and locate the SM_DoorFrame Static Mesh.
If you do not see the Props folder, refer to the Creating the Project step and make sure that you enabled Include Starter Content .
-
Left-Click on the SM_DoorFrame Static Mesh and drag-and-drop it into the Level Viewport .
-
Also in the Props folder, locate the SM_Door Static Mesh and drag-and-drop it into the Level Viewport.
-
In the Content Browser, find the SM_Door Static Mesh again and Double-Click on it to open it up in the Static Mesh viewer.
-
Inside the Details panel, in the search field type in Collision and set the Collision Complexity setting to Use Complex Collision as Simple .
The step above will ensure that the door has collision applied to it.
-
With the SM_Door selected in the Level Viewport find the Details panel. Under Transform and the Rotation setting, set the Z value to -180 .
It will auto adjust to -179.99 which is okay.
-
Using the Translation widget, position the door inside the door frame.
-
Inside the Modes menu and under the Basic tab, find the Box Trigger and drag-and-drop it into the Level Viewport inside the door frame.
-
Select the TriggerBox and in the Details panel under the Shape section, locate and change the X value for Box Extent to 140 .
Note: The Trigger Box extends past the door frame on the inside to allow it to open sooner (before the player approaches) as it will open inward.
For an example of a door that opens in different directions based on which way the player enters the Trigger Box using Blueprints , refer to the 2.4 - Door With Trigger Content Example.
-
The door and trigger are now placed, next we will add the Matinee Actor to open/close it.
Adding the Matinee Actor
In this step, we will add the Matinee Actor and set Keyframes to open/close the door.
-
From the Toolbar menu, select Matinee and click the Add Matinee button.
-
The Matinee undo warning message will appear, click the Continue button.
-
The Matinee Editor window will open.
Click for Full View.
-
Right-Click in the Tracks window (in the empty section below All ) and from the context menu, select Add New Empty Group .
-
When the window asking you to enter a New Group Name for the group appears enter a name for this group (in this example, we are using the name Door ).
-
Minimize the Matinee window, then in the Main Editor find the World Outliner window and select the SM_Door so that it is highlighted.
-
Return to the Matinee window and Right-Click on the Group (Door) to bring up the context menu, then select Actors then Add Selected Actors .
This will add the SM_Door Actor to the Door group.
-
Right-Click on the Group (Door) again to bring up the context menu, then select Add New Movement Track .
-
When the Movement Track is added, a new Keyframe will be automatically added at the time 0.00 (see 1 below) along with the track.
Note: Section 2 includes the Start/End Markers (Red Triangles), Loop Section (Green Triangles) and Time Bar (Black Bar).
-
Left-Click on the Time Bar and drag it to the time 0.50 , then press the Enter key to add a new Keyframe .
-
Minimize the Matinee window and return to the Level Viewport With the SM_Door still selected, press the E key to enter Rotation mode.
-
Left-Click the Blue arc of the Rotation widget (the widget will change), then rotate it to the right to -90.0 degrees.
-
Return to the Matinee window and Left-Click on the Red arrow End Marker and move it to the left to 0.50 .
-
The Matinee sequence set up is complete. In the next step, we will finish by hooking up the Matinee to the Trigger .
Hooking the **Matinee** up to the **TriggerBox**
In this step, we will hook up the Matinee to the TriggerBox so that it opens when entering the trigger and closes when exiting the trigger.
-
From the Toolbar menu, select Blueprints and click the Open Level Blueprint button.
-
Minimize the Level Blueprint and through the Level Viewport or World Outliner , Left-Click on the MatineeActor to select it.
-
Open the Level Blueprint window and Right-Click in the Event Graph , then in the context menu, select the Add Reference to MatineeActor option.
-
This will add the MatineeActor to the Event Graph of the Level Blueprint .
-
Minimize the Level Blueprint and through the Level Viewport or World Outliner , Left-Click on the TriggerBox to select it.
-
Open the Level Blueprint window and Right-Click in the Event Graph , then in the context menu under Add Event for TriggerBox and Collision , select the Add OnActorBeginOverlap option.
-
Right-Click in the Event Graph again, and repeat the previous step except select the Add OnActorEndOverlap option.
-
In the Event Graph find the MatineeActor node and Left-Click on and drag-off the output pin (Blue Circle) to bring up the context menu, then enter Play in the search field and select the Play option.
-
Drag-off the MatineeActor node again and in the context menu search field, enter Reverse and select the Reverse option.
-
Find the OnActorBeginOverlap node and drag-off the Execute output pin and connect it to the Play node's input pin.
-
Repeat the process above and connect the OnActorEndOverlap node's output pin to the Reverse node's input pin.
-
In the Level Blueprint's Toolbar menu, click the Compile Button.
-
The Blueprint is now complete and the TriggerBox is now hooked up to the Matinee Actor.
-
Minimize the Level Blueprint and click the Play Button in the main toolbar to play in the Editor.