Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:00,140 --> 00:00:03,620
In the last lesson, we created the blueprint for the character and placed it in the world.
2
00:00:03,650 --> 00:00:07,939
However, if we start the game, we are still just controlling this weird flying camera.
3
00:00:07,970 --> 00:00:13,370
We need to tell Unreal Engine which pawn we actually want the player to control, and the best way of
4
00:00:13,370 --> 00:00:15,230
doing that is to use a game mode.
5
00:00:15,230 --> 00:00:20,810
Blueprint A game mode lets us set the default classes to be used for the character, for the controller,
6
00:00:20,810 --> 00:00:21,800
and things like that.
7
00:00:21,800 --> 00:00:25,880
So let's open up the content drawer and go to the blueprints folder.
8
00:00:25,880 --> 00:00:31,880
Right click and create a new blueprint class, and we can actually find this in the comment section.
9
00:00:31,880 --> 00:00:34,100
We have the game mode base.
10
00:00:34,100 --> 00:00:38,270
So this defines like the game being played, the rules the score and things like that.
11
00:00:38,270 --> 00:00:38,630
Right.
12
00:00:38,630 --> 00:00:40,610
So this is exactly what we're looking for.
13
00:00:40,610 --> 00:00:42,770
So we can just click here Game Mode base.
14
00:00:42,770 --> 00:00:48,050
And I'm going to call game underscore action for the action platformer.
15
00:00:49,240 --> 00:00:55,030
We can then double click to open it up, and you can see that this is similar to the character blueprint.
16
00:00:55,030 --> 00:00:56,980
We actually have a viewport here.
17
00:00:56,980 --> 00:00:57,910
We have an event graph.
18
00:00:57,910 --> 00:01:00,280
So we could add some actual logic in here.
19
00:01:00,280 --> 00:01:02,110
And this is something we're going to do later.
20
00:01:02,110 --> 00:01:04,660
But for now we only care about the details panel.
21
00:01:04,660 --> 00:01:07,210
Here you can see all of the default classes.
22
00:01:07,210 --> 00:01:10,330
So we have the session the state the controller.
23
00:01:10,330 --> 00:01:12,250
And these are all things we don't have to worry about.
24
00:01:12,250 --> 00:01:15,220
But we care about the default pawn class.
25
00:01:15,220 --> 00:01:16,930
And now it's just default pawn.
26
00:01:16,930 --> 00:01:20,230
So we can click here and set it to our BP player.
27
00:01:20,230 --> 00:01:23,110
Not the action base but the BP player.
28
00:01:23,380 --> 00:01:25,990
And click here and compile and save.
29
00:01:26,230 --> 00:01:28,000
And this is still not enough right.
30
00:01:28,000 --> 00:01:32,770
Like if I start the game now, it still doesn't let us control the character, because the next step
31
00:01:32,770 --> 00:01:37,720
is that we also need to tell Unreal Engine to actually use this game mode as our default game mode.
32
00:01:37,720 --> 00:01:44,500
We can just go to edit, go to Project Settings, maps and Modes, and here you can see the default
33
00:01:44,500 --> 00:01:45,250
game mode.
34
00:01:45,250 --> 00:01:49,360
So we just have to click here and select our GM underscore action.
35
00:01:49,990 --> 00:01:54,760
And this is enough to first tell Unreal Engine, hey, please use this game mode, and the game mode
36
00:01:54,760 --> 00:01:59,260
will then tell Unreal Engine hey, this is the default pawn, so it kind of goes around multiple corners,
37
00:01:59,260 --> 00:02:01,780
but this is the way it's supposed to be done.
38
00:02:02,570 --> 00:02:05,120
When I click on play now, things are actually different.
39
00:02:05,120 --> 00:02:10,460
I click into the viewport and if I try to move the camera now, I actually can't move it anymore, even
40
00:02:10,460 --> 00:02:11,810
though I was able to do it before.
41
00:02:11,810 --> 00:02:16,580
So this already proves that something has changed, but it's still very hard to tell because we're in
42
00:02:16,580 --> 00:02:19,670
a different position than this character that we placed into the world.
43
00:02:19,700 --> 00:02:25,250
We can press shift and F1 to get control of our mouse back and click on eject.
44
00:02:25,250 --> 00:02:30,140
And if we go away now, we can see that it actually spawned in a new player for us.
45
00:02:30,140 --> 00:02:35,120
So there is if I go back again, you can see here is the player start position.
46
00:02:35,120 --> 00:02:38,630
The game will always use the player start and spawn a new pawn for us here.
47
00:02:38,630 --> 00:02:42,170
So we can actually just select this guy and delete it.
48
00:02:42,170 --> 00:02:47,480
And if I start now and hit on eject, you can see that it spawns our new character and we are actually
49
00:02:47,480 --> 00:02:48,380
possessing it.
50
00:02:48,380 --> 00:02:53,240
However, there is no camera setup in it yet, so that's the reason why we look kind of from a first
51
00:02:53,240 --> 00:02:54,020
person view.
52
00:02:54,050 --> 00:02:57,950
We need to create a camera that looks at the character from the side first.
53
00:02:57,980 --> 00:03:04,100
To add the camera, we need to go back to the blueprint and here blueprints characters not on the action
54
00:03:04,100 --> 00:03:06,380
chart because only the player is supposed to have the camera.
55
00:03:06,380 --> 00:03:09,080
So go into the player and open the BP player.
56
00:03:09,640 --> 00:03:12,550
And you might get this view that doesn't show you the full blueprint.
57
00:03:12,550 --> 00:03:16,960
You can just click here and open full Blueprint editor, and it's going to show you the full view where
58
00:03:16,960 --> 00:03:19,210
we have the viewport, where we have the event graph.
59
00:03:19,210 --> 00:03:19,660
Right.
60
00:03:19,660 --> 00:03:22,420
But we just want to have a look at the viewport now.
61
00:03:22,420 --> 00:03:27,040
And in here we want to add a new spring arm and a camera that is attached to it.
62
00:03:27,040 --> 00:03:30,190
And we want to attach the spring arm to the capsule.
63
00:03:30,190 --> 00:03:32,380
So make sure that you don't have the sprite selected.
64
00:03:32,380 --> 00:03:32,890
Nothing.
65
00:03:32,890 --> 00:03:36,310
Just select the capsule component and click on add.
66
00:03:36,580 --> 00:03:38,680
And here we can then look for spring.
67
00:03:39,530 --> 00:03:41,030
And have the spring arm.
68
00:03:41,600 --> 00:03:45,830
And while the spring arm is selected, click on add again and look for camera.
69
00:03:46,410 --> 00:03:47,010
Right.
70
00:03:47,010 --> 00:03:52,590
So now we have the spring arm which is attached to the capsule, and the camera which is attached to
71
00:03:52,590 --> 00:03:53,550
the spring arm.
72
00:03:53,550 --> 00:03:55,170
And why do we need a spring arm?
73
00:03:55,170 --> 00:03:58,080
Well, it just makes it easier to control the position of the camera.
74
00:03:58,080 --> 00:03:59,550
That's the only reason why.
75
00:04:00,100 --> 00:04:02,530
But now we just look at the character from behind.
76
00:04:02,530 --> 00:04:04,900
So we want to change the rotation of the spring arm.
77
00:04:04,900 --> 00:04:12,160
We can just select the spring arm and we can go into rotate mode here and just uh, drag here on the
78
00:04:12,160 --> 00:04:16,990
blue line on the blue area and drag by -90.
79
00:04:17,110 --> 00:04:17,589
Right.
80
00:04:17,589 --> 00:04:21,790
So on the yaw -90 means we look exactly at the character from the side.
81
00:04:23,320 --> 00:04:25,900
And now we can just drag this over here and start the game.
82
00:04:25,900 --> 00:04:29,590
And you can see that we're actually looking at the player now, which is great.
83
00:04:30,280 --> 00:04:35,590
However, the angle is not that interesting and we're a bit too close so we can go back to the spring
84
00:04:35,590 --> 00:04:36,100
arm.
85
00:04:36,100 --> 00:04:41,290
And first we can change the target arm length to 500 to get a little bit more distance.
86
00:04:41,290 --> 00:04:46,960
And also we can change the angle so we can drag here go up -15.
87
00:04:46,960 --> 00:04:48,790
Well we cannot get -15 here.
88
00:04:48,790 --> 00:04:52,270
So we can change the steps here from 10 to 5.
89
00:04:52,390 --> 00:04:54,880
And now we can go to -15.
90
00:04:54,880 --> 00:04:57,070
And this just gives us more interesting angle.
91
00:04:57,070 --> 00:04:58,090
Let's have a look at it.
92
00:04:58,090 --> 00:04:58,510
Right.
93
00:04:58,510 --> 00:05:01,060
So we can kind of look at the character a little bit from the top.
94
00:05:01,060 --> 00:05:05,230
We get more depth for the scene and this looks a lot better.
95
00:05:05,350 --> 00:05:08,500
But actually the direction of the sun is now a little bit weird.
96
00:05:08,500 --> 00:05:14,470
So we can hit shift and F1 to get the mouse back, eject and look again for our directional light.
97
00:05:15,510 --> 00:05:16,170
Like this.
98
00:05:16,170 --> 00:05:18,600
And we can then drag around here on this axis.
99
00:05:18,600 --> 00:05:21,150
And yeah, again I want to kind of have this angle.
100
00:05:21,150 --> 00:05:29,460
So 250 I can just copy this control C exit out again get the directional light and just control V to
101
00:05:29,460 --> 00:05:30,750
paste it in here again.
102
00:05:31,050 --> 00:05:32,460
And this is going to remember it.
103
00:05:32,460 --> 00:05:37,020
So even if I start the game now you can see that we get the nice lighting that we set up in the beginning.
104
00:05:37,710 --> 00:05:43,680
One more thing related to the spring arm that we want to set up early on is the do collision test setting.
105
00:05:44,100 --> 00:05:47,160
Uh, here on the spring, we can just look for do collision test.
106
00:05:47,160 --> 00:05:49,950
But I want to first show you what this actually does.
107
00:05:49,950 --> 00:05:56,850
So how this works is that if, for example, I can again put in here a add and go to shapes, add a
108
00:05:56,850 --> 00:05:59,760
cube and kind of just put this.
109
00:06:00,390 --> 00:06:04,410
In front of the player and this is going to block the camera.
110
00:06:04,410 --> 00:06:08,430
So if I start the game now, the camera is just shoved into the player.
111
00:06:08,430 --> 00:06:13,230
So the camera is basically the spring arm is going to be pushed towards the player.
112
00:06:13,230 --> 00:06:15,000
If we have do collision test on.
113
00:06:15,390 --> 00:06:20,610
And this can be very nice if you have scenes inside of houses and things like that, but usually during
114
00:06:20,610 --> 00:06:24,510
development, this causes a lot of confusion and actually makes things hard to work with.
115
00:06:24,510 --> 00:06:29,310
So I just want to go here to player and make sure you stop the game.
116
00:06:29,310 --> 00:06:34,710
Go to player spring arm and just remove the check mark from do collision test, compile and save.
117
00:06:34,710 --> 00:06:39,030
And now if I start the game, you can see that it simply ignores the collision here.
118
00:06:39,030 --> 00:06:41,400
And again it kind of depends on what kind of game you want to make.
119
00:06:41,400 --> 00:06:45,570
But usually during development, it's best to just turn this off to avoid any confusion.
120
00:06:45,570 --> 00:06:49,710
And we can then just delete the cube exit out here of the search.
121
00:06:49,710 --> 00:06:54,090
So we now created a camera and we are actually possessing the character.
122
00:06:54,090 --> 00:06:56,490
However, the character still doesn't have any movement, right?
123
00:06:56,490 --> 00:07:01,350
I can hit the arrows on my keyboard, I can hit buttons, but again, the character still doesn't really
124
00:07:01,350 --> 00:07:02,280
know what to do with that.
125
00:07:02,280 --> 00:07:04,680
So that is what we're going to take care of in the next video.
12314
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.