﻿1
00:00:04,380 --> 00:00:05,250
‫Hello and welcome.

2
00:00:05,250 --> 00:00:08,460
‫In this lecture, we're going to be polishing off this level.

3
00:00:08,460 --> 00:00:13,560
‫We're going to get it to the point where we can drop the gargoyle statue.

4
00:00:13,560 --> 00:00:20,790
‫We can go through into our new area and make it so that when we're in the mausoleum, we've got a gate

5
00:00:20,790 --> 00:00:22,200
‫over there, we've got a statue here.

6
00:00:22,200 --> 00:00:28,230
‫If we take the statue from its podium, the gate shuts and we can't get out in time.

7
00:00:28,230 --> 00:00:30,960
‫And we need to find something else to put on the podium.

8
00:00:30,960 --> 00:00:38,490
‫Let's dive in and see how we achieve all this so we attend to implementing this final puzzle in the

9
00:00:38,490 --> 00:00:39,390
‫crypt.

10
00:00:39,390 --> 00:00:46,440
‫So what we're going to do here is I'm going to place a podium in the center with a statue on it, and

11
00:00:46,440 --> 00:00:52,290
‫I'm going to put a railing or a gate above that can come down if you take the statue off.

12
00:00:52,290 --> 00:00:58,560
‫So if I look in medieval dungeon meshes and props, there is the hooded metal golden statue and the

13
00:00:58,560 --> 00:01:01,290
‫statue stand, which I'm going to be using both.

14
00:01:01,290 --> 00:01:04,290
‫So let's go ahead and bring the statue stand in.

15
00:01:04,290 --> 00:01:10,860
‫First, we can go into the full by four view to make sure I am positioning it roughly in the center

16
00:01:10,890 --> 00:01:11,440
‫that I'll do.

17
00:01:11,460 --> 00:01:15,480
‫And then let's bring in the hooded metal statue, you'll notice.

18
00:01:15,480 --> 00:01:20,070
‫Absolutely teeny tiny goodness me, that's absolutely minuscule.

19
00:01:20,070 --> 00:01:24,780
‫So what we're going to have to do is we're going to have to increase its scale.

20
00:01:24,780 --> 00:01:28,440
‫I'm just going to hit the lock button next the scale to make it all go together.

21
00:01:28,440 --> 00:01:30,150
‫Let's try ten times bigger.

22
00:01:30,180 --> 00:01:30,930
‫That's a bit large.

23
00:01:30,930 --> 00:01:34,020
‫Maybe about six times bigger is good for this statue.

24
00:01:34,020 --> 00:01:38,670
‫And let's place him on the statue's pedestal and rotate him around.

25
00:01:38,670 --> 00:01:41,010
‫Now you'll notice the scene keeps going dark.

26
00:01:41,010 --> 00:01:47,430
‫Now, this is because of the exposure compensation method that's being used in the scene.

27
00:01:47,430 --> 00:01:52,680
‫To change that, we need to go to our add actor quickly.

28
00:01:52,680 --> 00:01:57,810
‫Add basically go to volumes and we're going to look for.

29
00:01:58,680 --> 00:02:01,050
‫The post processing volume.

30
00:02:01,050 --> 00:02:07,680
‫I'm going to put that in the scene, right click on it, and I'm going to move it to the global folder

31
00:02:07,680 --> 00:02:09,030
‫and then selecting the actor.

32
00:02:09,030 --> 00:02:14,910
‫We're going to go into the details pane, going to go to the exposure setting and we're going to check

33
00:02:14,910 --> 00:02:22,050
‫metering mode here and change the metering mode from auto exposure histogram to auto exposure basic.

34
00:02:22,290 --> 00:02:25,380
‫And you can see this volume is actually quite a small block.

35
00:02:25,380 --> 00:02:32,220
‫What we can do is we can increase the size of this volume so that it applies to the whole area.

36
00:02:32,220 --> 00:02:33,780
‫So let's reposition it.

37
00:02:33,810 --> 00:02:38,400
‫Scroll down to the brush settings at the bottom where there is the X, Y and Z sizes.

38
00:02:38,410 --> 00:02:41,220
‫We can increase these and be a little bit generous.

39
00:02:41,220 --> 00:02:46,110
‫So we just want to include everywhere our player can go in our level like so.

40
00:02:46,110 --> 00:02:51,480
‫And now you can see the lighting is instantly getting better and we are not having this problem where

41
00:02:51,480 --> 00:02:55,350
‫if we're looking away from a light, everything gets really, really dark.

42
00:02:55,350 --> 00:03:02,040
‫So let's open up the content draw again because I want to bring in something from the architecture folder

43
00:03:02,040 --> 00:03:03,330
‫in the dungeon.

44
00:03:03,330 --> 00:03:05,760
‫I want the cell side mesh.

45
00:03:05,760 --> 00:03:10,830
‫So let's bring that in to our level to try and position that near the door.

46
00:03:10,830 --> 00:03:15,990
‫And I'm just going to take note of how high up it needs to be for it to be out of the way.

47
00:03:15,990 --> 00:03:25,770
‫So at the moment, the Z position is -440, and if I position it at zero zero, that is out of the way.

48
00:03:25,770 --> 00:03:32,250
‫So what I'm going to do is I'm going to position it down on the floor and I'm going to add a mover component

49
00:03:32,250 --> 00:03:38,730
‫and its offset should be positive for 14 because if you think about it, the statue is in the trigger

50
00:03:38,730 --> 00:03:40,170
‫zone or will be.

51
00:03:40,290 --> 00:03:43,980
‫And when it's in the trigger zone, we want it to lift up by 440.

52
00:03:43,980 --> 00:03:48,900
‫When we remove the statue, it's going to go down by 4 to 40 and lock off the area.

53
00:03:48,900 --> 00:03:51,960
‫So the statue needs some collision properties setting up.

54
00:03:51,960 --> 00:03:54,120
‫So we'll go to down to the collision presets.

55
00:03:54,120 --> 00:04:03,330
‫We're going to go to custom and we want the grabber to block this particular object because we want

56
00:04:03,330 --> 00:04:04,920
‫to be able to grab hold of it.

57
00:04:04,920 --> 00:04:11,190
‫And if we go down to the pawn, we want the pawn to be ignored by this particular object so that we

58
00:04:11,190 --> 00:04:12,270
‫don't collide with it.

59
00:04:12,270 --> 00:04:18,540
‫And we're going to need it to generate overlap events as well because we need it to overlap with our

60
00:04:18,540 --> 00:04:19,260
‫trigger.

61
00:04:19,260 --> 00:04:21,390
‫Talking of trigger, we don't have that yet.

62
00:04:21,390 --> 00:04:29,280
‫So let's select our statue stand and let's add to that a trigger component like so.

63
00:04:29,280 --> 00:04:37,170
‫And then let's reposition that trigger so that it encompasses the statue and then let's add an acceptable

64
00:04:37,170 --> 00:04:45,780
‫tag which is going to be unlock two for me and let's select the statue will go to its actor section

65
00:04:45,780 --> 00:04:52,200
‫and add a tag which is going to have to match as unlock to let's maximize this viewport.

66
00:04:52,200 --> 00:04:58,320
‫And now what we need to do is make that link between the trigger and the mover.

67
00:04:58,320 --> 00:05:02,010
‫And we're going to do this in the level blueprint because we've set this up in the level.

68
00:05:02,010 --> 00:05:05,100
‫These actors aren't connected to each other in any other way.

69
00:05:05,100 --> 00:05:10,770
‫So we're going to go to the blueprint button, go open level blueprint, and then making sure we've

70
00:05:10,770 --> 00:05:12,600
‫got our statue stand selected.

71
00:05:12,600 --> 00:05:17,370
‫We're going to go pull off of Begin Play or rather we're going to click in the scene and add a create

72
00:05:17,400 --> 00:05:18,360
‫reference to the statue.

73
00:05:18,360 --> 00:05:19,680
‫Stand from this.

74
00:05:19,680 --> 00:05:21,480
‫We need to get that trigger component.

75
00:05:21,480 --> 00:05:25,470
‫So we're going to do a get component by class.

76
00:05:26,360 --> 00:05:31,070
‫And we're going to select the class to be the trigger component.

77
00:05:31,070 --> 00:05:33,230
‫So we've got a trigger component class here.

78
00:05:33,260 --> 00:05:37,340
‫Then the other part of the puzzle is to go and select our.

79
00:05:38,310 --> 00:05:43,530
‫Sell actor and having that selected, we're going to go into the dungeon level.

80
00:05:43,530 --> 00:05:46,890
‫We're going to right click and create a reference to the cell actor.

81
00:05:46,890 --> 00:05:51,570
‫And then using that cell, we're going to again get component by class.

82
00:05:51,570 --> 00:05:54,180
‫The class that we're looking for this time is the mover.

83
00:05:54,180 --> 00:06:03,120
‫And then pulling off of our return value from the trigger component, we can call set mover and connect

84
00:06:03,120 --> 00:06:07,230
‫up the mover pin and connect up the execution pin to begin play.

85
00:06:07,230 --> 00:06:11,730
‫And the other thing we have to do is select the cell and we need to make it movable.

86
00:06:11,730 --> 00:06:15,870
‫So if we go to general, we can select movable in there.

87
00:06:16,530 --> 00:06:20,250
‫We probably need to do the same with our hooded statue that needs to be movable.

88
00:06:20,250 --> 00:06:21,150
‫It already is.

89
00:06:21,150 --> 00:06:27,300
‫Let's go ahead and hit play and you can see that the cell side has moved out of the way, has reached

90
00:06:27,300 --> 00:06:31,890
‫up to the ceiling because our statue is in the trigger component.

91
00:06:31,890 --> 00:06:34,080
‫But I can't pick the statue up.

92
00:06:34,080 --> 00:06:40,170
‫And the reason for that is that it's currently being held onto by the trigger component and it's being

93
00:06:40,170 --> 00:06:42,660
‫set to not simulate physics.

94
00:06:42,660 --> 00:06:47,280
‫So we need to add that into our grabber.

95
00:06:47,280 --> 00:06:55,770
‫CP So let's challenge you to activate this statue so that it is ready to move out of that trigger component.

96
00:06:55,770 --> 00:07:00,840
‫To do that, you're going to need to set simulate physics on the hit component, you're going to set

97
00:07:00,840 --> 00:07:02,160
‫it simulate physics to true.

98
00:07:02,430 --> 00:07:05,010
‫You're also going to have to detach the actor.

99
00:07:05,010 --> 00:07:07,650
‫So detach actor, detach from actor.

100
00:07:07,650 --> 00:07:12,960
‫And you can see that just like we had attachment transform roles, we've got detachment transform roles

101
00:07:12,960 --> 00:07:13,590
‫as well.

102
00:07:13,590 --> 00:07:17,610
‫And for this one as well, we're going to be using Keep World Transform.

103
00:07:18,090 --> 00:07:23,550
‫And then as a bonus, once you take that statue out of the trigger component, you're going to notice

104
00:07:23,550 --> 00:07:29,460
‫that the gate doesn't automatically rise because we've currently got our mover working in only one direction.

105
00:07:29,460 --> 00:07:31,980
‫So as a bonus, make it work both ways.

106
00:07:31,980 --> 00:07:37,020
‫If you put something into the trigger volume, it moves to the goal and if you take it out, then it

107
00:07:37,020 --> 00:07:38,550
‫moves back to start.

108
00:07:38,550 --> 00:07:40,740
‫So pause a video and have a go.

109
00:07:43,780 --> 00:07:44,170
‫Okay.

110
00:07:44,170 --> 00:07:45,130
‫Welcome back.

111
00:07:45,550 --> 00:07:52,180
‫So first of all, in the grab CP where we are grabbing things, we have got this way called rigid bodies

112
00:07:52,180 --> 00:07:53,410
‫from the hit component.

113
00:07:53,410 --> 00:08:00,820
‫Let's take that hit component and we're going to set simulate physics to true.

114
00:08:00,940 --> 00:08:04,660
‫And then we've got this getting the actor here.

115
00:08:04,660 --> 00:08:07,810
‫I'm going to put that into its own variable.

116
00:08:07,810 --> 00:08:16,990
‫So a actor, star hit actor is equal to hit result get actor and then we can replace that.

117
00:08:16,990 --> 00:08:18,730
‫So hit actor tags.

118
00:08:18,730 --> 00:08:22,390
‫And then further down we're going to detach that actor as well.

119
00:08:22,390 --> 00:08:32,380
‫So hit actor arrow detach from actor and then we're going to do an F detachment, transform rules,

120
00:08:32,380 --> 00:08:38,170
‫colon, colon, keep world, transform a semicolon at the end of the line and let's recompile and see

121
00:08:38,170 --> 00:08:39,100
‫if that works.

122
00:08:39,100 --> 00:08:43,060
‫Let's go ahead and hit play and try and pick up our statue.

123
00:08:43,510 --> 00:08:46,750
‫And this time it comes away just perfectly.

124
00:08:46,930 --> 00:08:50,440
‫However, our gate doesn't close as it should do.

125
00:08:50,440 --> 00:08:53,350
‫So how are we going to go ahead and make our gate close?

126
00:08:53,350 --> 00:08:56,050
‫Let's see if we can put the statue back on the stand.

127
00:08:56,440 --> 00:08:59,650
‫So let's stick it over here and there you go.

128
00:08:59,890 --> 00:09:05,200
‫It stays there by itself because it gets automatically attached to the trigger component.

129
00:09:05,470 --> 00:09:10,850
‫So for the move, a component of the challenge, the bonus, if we go and open up the mover, which

130
00:09:10,850 --> 00:09:16,660
‫you can do with control P by the way, and search for mover and we can open up the move of CP, then

131
00:09:16,660 --> 00:09:20,350
‫we can go down to where it's got if should move.

132
00:09:20,350 --> 00:09:26,230
‫And you can see that essentially we want an alt statement here that sets the target location just to

133
00:09:26,230 --> 00:09:30,970
‫the original location in in the alternative case.

134
00:09:31,450 --> 00:09:36,040
‫And basically the rest of the code needs to run all the time to move to the location.

135
00:09:36,040 --> 00:09:43,090
‫So let's take it all out of our if statement like so and fix up any indentation issues.

136
00:09:43,090 --> 00:09:45,760
‫And essentially what we want is the target location.

137
00:09:46,210 --> 00:09:51,790
‫We're going to set it to a default value before the if statement.

138
00:09:51,790 --> 00:09:55,900
‫So the default value is going to be the original location.

139
00:09:55,900 --> 00:09:58,420
‫I'm going to just cut out that move offset.

140
00:09:58,420 --> 00:10:01,900
‫So what we've got is we set up a target location with the original location.

141
00:10:01,900 --> 00:10:06,160
‫So by default, it's going to want to move back to its original location.

142
00:10:06,160 --> 00:10:13,420
‫But if should move is true, then we need to update the target location to be equal to essentially the

143
00:10:13,420 --> 00:10:17,980
‫original location plus the move offset.

144
00:10:17,980 --> 00:10:21,550
‫So that takes us to essentially our goal location.

145
00:10:21,700 --> 00:10:24,850
‫So then later on we can calculate the current location.

146
00:10:24,850 --> 00:10:27,910
‫We do the distance and the speed calculation.

147
00:10:27,910 --> 00:10:33,070
‫We do the V interpret constant to and we set the new active location.

148
00:10:33,070 --> 00:10:38,440
‫And one more thing we need to do is change the way we calculate the speed, because here we are looking

149
00:10:38,440 --> 00:10:44,110
‫for the difference between the original location and the target location, which when we set the target

150
00:10:44,110 --> 00:10:46,840
‫location equal to the original location is going to be zero.

151
00:10:46,840 --> 00:10:48,670
‫And so our speed is going to be zero.

152
00:10:48,670 --> 00:10:53,680
‫So instead, well, we know the difference between the target location in an original location is actually

153
00:10:53,680 --> 00:10:56,320
‫the length of the move offset.

154
00:10:56,320 --> 00:11:01,090
‫So what we can do, instead of calculating the distance this way, which is always a bit wasteful,

155
00:11:01,090 --> 00:11:07,150
‫is we can do a move offset dot length and divide that through by the move time.

156
00:11:07,150 --> 00:11:12,070
‫So that's a need some parenthesis because it's a function move offset dot length parentheses divided

157
00:11:12,070 --> 00:11:13,090
‫by the move time.

158
00:11:13,090 --> 00:11:14,830
‫Let's recompile and try that out.

159
00:11:14,920 --> 00:11:21,150
‫Go ahead and hit play, pick up our statue and you can see the gate goes to close.

160
00:11:21,160 --> 00:11:25,330
‫I didn't quite let it open, so maybe we didn't see that it goes the whole way.

161
00:11:25,330 --> 00:11:29,920
‫But if I drop the statue in its place, it lifts all the way up to the top.

162
00:11:30,400 --> 00:11:35,050
‫Take the statue off and it goes all the way back down to the bottom.

163
00:11:35,050 --> 00:11:35,590
‫Great stuff.

164
00:11:35,590 --> 00:11:43,300
‫So now all that remains for me to do is add a little plot or something that we can take for the puzzle.

165
00:11:43,300 --> 00:11:50,440
‫So I'm going to go into the meshes under the props and I find a little complete pot and put it by this

166
00:11:50,440 --> 00:11:52,960
‫other door on the other side.

167
00:11:52,960 --> 00:11:56,980
‫So there's a little bit of a challenge trying to find something we can put in the statue's place.

168
00:11:56,980 --> 00:12:02,230
‫I'm going to set it to generate overlap events just like the statue, the collision presets we need

169
00:12:02,230 --> 00:12:04,150
‫to set to custom.

170
00:12:04,900 --> 00:12:11,080
‫We're going to change that so that the grabber can grab it, so put it to block and that it doesn't

171
00:12:11,080 --> 00:12:12,580
‫overlap the pawn.

172
00:12:12,580 --> 00:12:18,520
‫And we're going to go to the actor tags, add a tag for unlock two.

173
00:12:18,520 --> 00:12:22,780
‫And then the final thing we need to go and do is set it to move a ball.

174
00:12:22,780 --> 00:12:25,390
‫Let's go ahead and hit play and see if we can grab this pot.

175
00:12:25,390 --> 00:12:25,780
‫Yep.

176
00:12:25,780 --> 00:12:26,920
‫Looks like we can.

177
00:12:26,920 --> 00:12:30,490
‫Let's go and take it through into this mausoleum area.

178
00:12:31,000 --> 00:12:37,810
‫We can take off the statue, take our pot and stick it in its place.

179
00:12:38,380 --> 00:12:42,730
‫And you can see that it opens up and we can take the statue and make a run for it.

180
00:12:43,280 --> 00:12:43,890
‫At stake.

181
00:12:43,910 --> 00:12:51,500
‫So in this lecture, we've tidied up the rest of our level and completed the game that involved making

182
00:12:51,500 --> 00:12:58,760
‫a few code changes, including making the mover move back and allowing the grabber to detach things

183
00:12:58,760 --> 00:13:01,760
‫that it picks up and set them to simulate physics.

184
00:13:01,790 --> 00:13:02,680
‫Great stuff.

185
00:13:02,690 --> 00:13:04,520
‫I'll see you in the next lecture.

