Of course, there are many other things that we can do inside Blueprints instead of flickering a light. Another example would be to open a door when we get near it making use of Matinee.
Before we start working within the Unreal Editor, we will need to have a project to work with which contains the Starter Content that Epic provides. After the project is opened, go to the Example Code
folder and drag and drop the HouseExample
map provided into your project folder and open it.
In order to have our doors open, we will want them to be animated. To do this, we will use Unreal's Matinee system:
Currently, our doors do not have collision. Let's fix this by looking at the common reasons for why things cannot be working correctly.
Inside this editor, you can modify any properties that are part of this mesh, including the materials used and the way it reacts to shadows.
For more information on the Static Mesh Editor, refer to https://docs.unrealengine.com/latest/INT/Engine/Content/Types/StaticMeshes/Editor/index.html.
Now, if we play the game, you'll notice that we can no longer walk through it!
Once this is created, there is a new Actor added to our SceneOutliner called MatineeActor1
, and the Matinee Editor opens up.
For information on the Matinee Editor and what each section is for, refer to https://docs.unrealengine.com/latest/INT/Engine/Matinee/UI/index.html.
Door1
. Once this is created, right-click on Door1 and select Add New Movement Track.This is letting Matinee know that we want to modify the movement (position, rotation, and scale) of the door object during our animation. It's also worthwhile to note that if the door is not a moveable object, Unreal will automatically change it to one at this point.
Animations are done in terms of keyframes. You can already see one created on each Movement track with those red triangles. This current animation lasts for 5 seconds (which you can see with the 5.00 value where the edges are). Use the mouse wheel to zoom in and out).
1.5
seconds. Then, select each Movement track individually and click on Add Key on the top-left (or press Enter). To see the animation with the playback system, also move the green highlighted timeline to 1.5 seconds.This is stating that in 1.5 seconds, I want these objects to be somewhere else and I want the computer to intelligently move between the two values (also known as a tween).
120
degrees.We now want this animation to play whenever we get near the door, so with that in mind, we can use Box Trigger to detect when we are near.
A trigger is something that detects collision, but unlike other things, with collider, it does not attempt to block the player from entering it. This is used often in games for the events that happen when something enters an area. If you've played a first person shooter, you may notice a trigger being used whenever you see a group of enemies spawning to attack the player because you entered an area.
TriggerBox
actor and scroll down to Blueprint. From here, select Add Level Events for TriggerBox and from the popup, select Add OnActorBeginOverlap. This will be called whenever our TriggerBox has been overlapped by another object.MatineeActor
and drag and drop it into the Blueprints window. Then, drag from its blue line to bring up the possible functions that use it and search for Play. Connect the output from BeginOverlap to the input of Play.With this, you have learned to use Triggers to modify things that happen in the game!
For simple animations, such as the one done here, it's also possible to make use of UE4's Timelines. For a tutorial on that, visit https://docs.unrealengine.com/latest/INT/Engine/Blueprints/UserGuide/Timelines/Examples/OpeningDoors/index.html.
For additional examples on how to use Matinee to do different things, refer to https://docs.unrealengine.com/latest/INT/Engine/Matinee/HowTo/index.html.
18.191.13.255