72 Game Development and Simulation with Unreal Technology
3. Drag a Box Trigger into the level.
4. If the Box Trigger is not selected, Left-click on its icon to select it.
FIGURE 2.33: The Trigger Volume for the Entrance of the Lobby.
5. In the Details rollou t of the Box Trigger change its properties as follows:
Mobility: Static
Box Trigger Name: WestTriggerBox
Box Extent X: 300
Box Extent Y: 300
Box Extent Z: 25 0
6. Move and place the Box Trigger so that it is placed and centered at the middle
of the Lobby entrance door.
7. You want to have the box to stick out of the door frame on both the inside and
outside of the door so that it gives enough space for the player to activate the
Introdu ction to Level Design in Unreal Technology 73
sliding doors (see Figure 2.33).
8. With the W estTriggerBox selected, hold the Alt+Shi ft and dra g a copy of the
trigger box onto the east entrance of the lobby.
9. Rename the du plicate Trigger Box to EastTriggerBox.
OPENING THE LEVEL BLUEPRINT
With the trigger box created, we are now ready to start p rogram ming the sliding
door functionality.
10. On the main editor toolbar locate th e Blueprints button .
11. Left-click on the H next to the Blueprints button and f rom the popup menu
select the O pen Level Bluepri nt option.
12. This will open up the Level Blueprint in the Blueprint Editor.
ADDING TIMELINES
With the Level Blueprint o pen in the Blueprint Editor, yo u will see the Event
Graph empty. This is where you program your level blueprint. T he first task
we will perform is to create a tim eline. A timeline is basically a curve which
we c an utilize to control any dynamic aspect of the game contro lled by a time-
dependent function. Since the sliding door functionality can be represented as
the translation of the glass doors over a period of time, this functionality is
perfectly suitable to be implemented by a timeline.
13. Right-click somewhere on the Event Graph in the Blueprint Ed itor.
14. Type Timelin e in the search bar of the popup menu.
15. Select the Add Timeline option.
16. This will create a timeline in your level blueprint (see Figure 2.34(a)).
17. Rename this timeline to WestDoorTimeline.
(a) (b)
FIGURE 2.34: (a) Create a Timeline. (b) Create a Vector Track for Sliding Doors in the
Curve Editor.
74 Game Development and Simulation with Unreal Technology
18. Double-c lick on the timeline to open it up in the curve editor.
19. Check the checkbox Use Last Keyframe? for the WestDo orTimeline.
20. Left-cli ck on the V
+
icon to add a Vector Track to your timeline (see Fig-
ure 2.34(b)).
21. Rename the Vect or Track to WestDoor wayTrack.
22. Hold the Shift key on your keyboar d and Left-cli ck on the track at time 0.0
to a dd a key in tha t location along the timeline.
23. Hold the Shift key on your keyboar d and Left-cli ck on the track at time 2.0
to a dd another key in that location along the timeline.
24. We would like to have the doors slide along their Y-axes. We will lock the X- and
Z- axes. To do so, Left-click on the lock ic on next to the X- and Z- axes.
25. With the X- and Z- axes locked, we c an now enter values in our Y component of
the vector tra ck. We would like the door to slide about 250 units along its Y- axis.
26. Left-cli ck on the key (the d ia mond shape) on at time 2.0 and type the value
of 250 in the Value box on the upper left corner of the curve editor (see Fig-
ure 2.34(b)).
27. If th e key fr ame sna ps out of the view, you can re-scale the curve editor by clicking
on the l on the upper left corner of the editor.
28. Repeat Steps 13–27 to create another timeline and Vector track for th e East
Door. Name this timeline E astDoorTimeline and its corresponding Vector track
EastDoorwayTrack.
ESTABLISHING INITIAL DOOR LOCATIONS
Now that we have our timelines and vector tracks for the lo cations of sliding
doors ready, it is the time to start programming. In this step, we will establish
the initial locations of the four sliding glass doors and store these values in
variables. Remember that we have two sliding doors for the west entrance and
two for the ea st entrance to the lobby.
29. Left-cli ck on the new Variable (
+
V icon) u nder the My Blueprint tab to
create a new variable in your level blueprint.
30. Rename this variable to WestDoor1L ocation.
31. In the WestDoo r1Location variable’s Details rollout, click on the Variable
Type drop-down list and choose Vector (see Fig ure 2.35(a) ).
32. Create three additional variables of type Vector and ren ame them to
WestDoor2Location, EastDoor1Locatio n, and EastDoor2Loc ation.
33. Your My Blueprint tab should look similar to Figure 2.35(b) .
34. Go back to the main editor by either minimizing the Blueprint Editor or moving
it out of the way, momentarily.
35. In the main editor, Left-click on the WestDoor1 glass door mesh to select it.
36. With the WestDoor1 selected, go back to the Blueprint Editor.
37. Right-cl ick on the Event Graph.
38. From the menu select the Add Reference to WestDoor1 (see Figure 2.36(a)).
39. Right-cl ick above the West Door1 reference on the Event Graph.
Introdu ction to Level Design in Unreal Technology 75
(a) (b)
FIGURE 2. 35: (a) Variable Details Rollout. (b) Four Variables Created to Hold the Glass
Door’s Initial Locations.
40. Type Even t Begin Play in the search bar and place the Event Begin Play
event trigger above the WestDoor1 reference .
41. Drag a wire out from the WestDoor1. This will open up the p opup menu again.
42. Uncheck the Context Sensiti ve checkbox a nd ty pe Get Actor Loca tion in
the search bar.
43. Place the Get A ctor Location node to the right of the Wes tDoor1 actor refer-
ence (see Figure 2.36(b)).
44. Drag the WestDoor1Location variable you created earlier onto the Event Graph
to the right of the G et Ac tor Location node and choose Set from th e menu.
This will plac e a Setter for the WestDoor1Location variable.
45. Make the following conne ctions (see Figure 2.36( c)):
Get Actor Loca tion Return Value outpu t WestDoor1Location input.
Event Begin Play exec (white) output Set exec (whi te ) input.
46.
Go back to the main editor by either m inimizing the Blueprint Editor or moving
it out of the way, momentarily.
47. In the main edito r, Left-cl ick on the WestDoor2 glass door mesh to select it.
48. With the WestDoor2 selected, go back to th e Blueprint Editor.
49. Right-click on the Even t Graph below the Get Actor Location.
50. From the m enu select the Add Reference to WestDoor2.
51. Drag a wire out from the WestDoor2. This will open up the p opup menu again.
52. Make sure the Context Sensitive checkbox is unchecked and type Get
Actor Location in the search bar.
76 Game Development and Simulation with Unreal Technology
(a) (b)
(c)
FIGURE 2.36: (a) Placing a Reference to an Actor in the Event Graph. (b) Getting the Actor’s
Location. (c) Storing the Initial Location of the Door.
53. Place the Get A ctor Location node to the right of the WestDoor2 actor refer-
ence.
54. Drag the WestDoor2Locat ion variable you created earlier onto the Event Grap h
to the right of the Get Actor Loc ation node and choose Set from the menu.
This will place a Setter for the WestDoor2Location variable.
55. Make the following conne ctions:
Get Actor Location Return Value output WestDoor2Location inp u t.
1
st
Set exec (white) output 2
nd
Set exec (white) input.
56. Go back to the main editor by either minimizing the Blueprint Editor or moving
it out of the way, momentarily.
57. In the main editor, Left-click on the EastDoor1 glass door mesh to select it.
58. With the EastDoor1 selected, go back to the Blueprint Editor.
59. Right-cl ick on the Event Graph below the Get Actor Locat ion.
60. From the menu select the Add Reference to EastDoor1.
61. Drag a wire out from the EastDoor1. This will ope n up the popup menu again.
62. Make sure the Context Sensitive checkbox is unchecked and type Get
Actor Location in the search bar.
63. Place the Get A ctor Location node to the right of the EastDoor1 actor refer-
ence.
64. Drag the EastDoor1Locat ion variable you created earlier onto the Event Grap h
to the right of the Get Actor Loc ation node and choose Set from the menu.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.144.114.85