﻿1
00:00:04,380 --> 00:00:05,520
‫Hello and welcome.

2
00:00:05,520 --> 00:00:11,880
‫In this lecture, we're going to be setting up a game mode and a custom player pawn so that we can walk

3
00:00:11,880 --> 00:00:19,590
‫around our level as a first person player ready to play some gameplay mechanics.

4
00:00:19,590 --> 00:00:21,750
‫Let's dive in and see how this works.

5
00:00:22,350 --> 00:00:28,560
‫So we've already seen how when I hit play, I just go straight through the floor here.

6
00:00:28,560 --> 00:00:36,090
‫So we kind of want to fix that so that we can play inside our level without fear of falling through

7
00:00:36,090 --> 00:00:36,750
‫floors.

8
00:00:36,750 --> 00:00:45,060
‫So the problem is that this SM floor mesh does not have any collision set up on it, so we can hit the

9
00:00:45,060 --> 00:00:47,970
‫Browse to SM floor and content browser button.

10
00:00:48,270 --> 00:00:57,510
‫We can open up the SM mesh editor and dock it to the main window and then we can go to the show button

11
00:00:57,510 --> 00:01:03,120
‫and hit show simple collision and see that there are no simple collision meshes.

12
00:01:03,240 --> 00:01:09,540
‫To add one in, we're going to go to the collision button in the toolbar and go to add box simplified

13
00:01:09,540 --> 00:01:12,540
‫collision, which automatically adds it around the mesh.

14
00:01:12,540 --> 00:01:18,060
‫Now, just to make sure we don't fall through this floor, I want to make that box a little bit thicker.

15
00:01:18,060 --> 00:01:18,540
‫At the moment.

16
00:01:18,540 --> 00:01:20,190
‫It's kind of zero thickness.

17
00:01:20,610 --> 00:01:27,660
‫So what we can do is go in the details pane, scroll on down where we're going to find the primitives

18
00:01:27,660 --> 00:01:31,140
‫collision section, and then under it there is primitives.

19
00:01:31,230 --> 00:01:38,070
‫And this tells us, this shows us the different primitives that make up the collisions.

20
00:01:38,070 --> 00:01:44,010
‫And some of the primitives are things like spheres, boxes, capsules, etc. We've got boxes, so let's

21
00:01:44,010 --> 00:01:45,390
‫open up the box.

22
00:01:45,390 --> 00:01:50,940
‫We can see its center is here, we can see the rotation, we can see the extents, which basically means

23
00:01:50,940 --> 00:01:53,580
‫how large it is and the Z extent is zero.

24
00:01:53,580 --> 00:01:56,070
‫So let's make that ten centimeters instead.

25
00:01:56,070 --> 00:02:00,570
‫So you can see that's made the box slightly thicker, but I don't want our character to be standing

26
00:02:00,570 --> 00:02:01,440
‫on top of the floor.

27
00:02:01,440 --> 00:02:07,140
‫So what I'm going to do is I'm going to change its center to be at minus ten so that basically we've

28
00:02:07,140 --> 00:02:10,290
‫got that box, but it's underneath our floor.

29
00:02:10,290 --> 00:02:12,990
‫So you can go ahead and hit save to the mesh.

30
00:02:12,990 --> 00:02:16,270
‫And now if we hit play, hopefully, there you go.

31
00:02:16,270 --> 00:02:19,950
‫And we are able to walk around on the floor without falling through it.

32
00:02:19,950 --> 00:02:26,310
‫Now, there may be other meshes that you discover that have similar problems and you can't you you can

33
00:02:26,310 --> 00:02:27,480
‫pass through.

34
00:02:27,480 --> 00:02:31,200
‫In this case, the doors for me are not actually wide enough to fit my character.

35
00:02:31,710 --> 00:02:34,710
‫So I'm going to have to open these doors a smidge more.

36
00:02:35,100 --> 00:02:38,880
‫So now that those doors are wider, we should be able to fit through them.

37
00:02:38,880 --> 00:02:39,870
‫No problem.

38
00:02:39,870 --> 00:02:40,770
‫And we do.

39
00:02:40,860 --> 00:02:46,200
‫And we can now walk around our level as a first person character.

40
00:02:46,230 --> 00:02:51,780
‫However, this first person character is set up for a first person shooter with first person shooter

41
00:02:51,780 --> 00:02:54,960
‫arms, and that's not what I want.

42
00:02:54,960 --> 00:02:59,190
‫So we're going to adapt this character for our own uses.

43
00:02:59,190 --> 00:03:05,580
‫So let's find where that first person character is, and that's under the content first person blueprints.

44
00:03:05,580 --> 00:03:08,340
‫And we've got first person character in here.

45
00:03:08,340 --> 00:03:13,650
‫I'm going to right click on it and create a Child Blueprint class, which I'm going to call BP, underscore

46
00:03:13,680 --> 00:03:14,370
‫player.

47
00:03:15,000 --> 00:03:21,750
‫And this player, we're going to move to the root of content, click move there.

48
00:03:22,020 --> 00:03:32,190
‫And then what we want to do is create a new default game mode and set this player as the default to

49
00:03:32,190 --> 00:03:33,120
‫get spawned.

50
00:03:33,120 --> 00:03:38,880
‫But before I challenge you to do that, let's modify this player so that we remove the arms that are

51
00:03:38,880 --> 00:03:39,510
‫there.

52
00:03:39,510 --> 00:03:45,360
‫So when we open up the BP player blueprint, you can see that we've got a bunch of components here.

53
00:03:45,360 --> 00:03:50,940
‫One of them is the mesh one PE basically mesh first person, which is the arms.

54
00:03:51,150 --> 00:03:59,460
‫And what we can do here is we can simply go down to where we've got these skeletal mesh property and

55
00:03:59,460 --> 00:04:06,480
‫clear that so that we don't have any mesh selected to render for the first person.

56
00:04:06,600 --> 00:04:11,070
‫Now, if we were to play as the first person player, we'll see that we now works exactly the same,

57
00:04:11,070 --> 00:04:15,870
‫except we've got no mesh arms, but that requires a game mode.

58
00:04:15,870 --> 00:04:19,020
‫So let me refresh your memory on how we create a game mode.

59
00:04:19,020 --> 00:04:24,720
‫We go over into a level, we go to the blueprint button in the toolbar, we go to where it says game

60
00:04:24,720 --> 00:04:27,660
‫mode, and we've currently got a Crypt Raider game mode.

61
00:04:27,660 --> 00:04:35,670
‫And what we want to do is go into this and click Create and we want to create a new game mode based

62
00:04:35,670 --> 00:04:37,200
‫off of this Crypt Raider game mode.

63
00:04:37,200 --> 00:04:40,500
‫The Crypt Raider game mode is a C++ game mode.

64
00:04:40,500 --> 00:04:45,810
‫So what we can do is we can create a blueprint version of it to link to other blueprint classes.

65
00:04:45,810 --> 00:04:51,780
‫So let's click on the Crypt Raider game mode, click the root of content, and we're going to call this

66
00:04:51,780 --> 00:04:58,080
‫game mode the beep underscore crypt Raider game mode and hit save.

67
00:04:58,080 --> 00:05:01,260
‫And then we have our game mode launch up like so.

68
00:05:01,260 --> 00:05:03,360
‫So I'd like to challenge you to set up.

69
00:05:03,440 --> 00:05:09,140
‫Your own game mode, you're going to set it as the project default so that it's being used in any of

70
00:05:09,140 --> 00:05:11,090
‫the levels you set up in this project.

71
00:05:11,420 --> 00:05:16,880
‫Set the default pawn for the game mode to that player -- that we've just created and removed the arms

72
00:05:16,880 --> 00:05:17,420
‫from.

73
00:05:17,750 --> 00:05:21,540
‫And check that that is the -- that spawns in your game now.

74
00:05:21,560 --> 00:05:23,060
‫Pause the video and have a go.

75
00:05:26,510 --> 00:05:26,930
‫Okay.

76
00:05:26,930 --> 00:05:27,790
‫We'll come back.

77
00:05:27,800 --> 00:05:33,680
‫So first thing, because I'm here in the game mode already, I can select the default -- class.

78
00:05:33,680 --> 00:05:40,820
‫It's currently set to the first person class, but I want to change it to the BP player instead.

79
00:05:41,300 --> 00:05:47,690
‫I'm going to save that and then I'm going to go over to the dungeon level, go to the blueprint button,

80
00:05:47,750 --> 00:05:53,270
‫and I'm going to check that our project default, in fact, it looks like we've already done this.

81
00:05:53,270 --> 00:05:59,870
‫The project settings basically by having created it here is using the BP Crypt Raider game mode already.

82
00:05:59,870 --> 00:06:06,020
‫So if I go ahead and hit play, you can see the -- created moves like a first person --, but I

83
00:06:06,020 --> 00:06:12,830
‫no longer have those arms in front of me, which is more in keeping with the style of genre that we've

84
00:06:12,830 --> 00:06:13,430
‫got here.

85
00:06:13,850 --> 00:06:14,960
‫Great stuff.

86
00:06:14,960 --> 00:06:21,860
‫So we've set up our character blueprint ready for some gameplay action, which we will start to do in

87
00:06:21,860 --> 00:06:23,000
‫the following lectures.

88
00:06:23,000 --> 00:06:23,870
‫I'll see you there.

