﻿1
00:00:04,490 --> 00:00:05,750
‫Hello and welcome.

2
00:00:05,750 --> 00:00:10,790
‫In this lecture, we're going to be looking at how we can add multiple components to an actor so that

3
00:00:10,790 --> 00:00:17,300
‫we can have multiple meshes and a more complicated actor that acts as a single unit when it comes to

4
00:00:17,300 --> 00:00:17,990
‫physics.

5
00:00:17,990 --> 00:00:20,270
‫Let's dive in and see how to do this.

6
00:00:21,230 --> 00:00:28,400
‫So now that we've got a decent looking level, let's look at putting together a little bit of a diorama

7
00:00:28,400 --> 00:00:29,930
‫for us to knock down.

8
00:00:29,930 --> 00:00:39,350
‫Now, you'll notice that when I dragged in this rack mesh, it created an actor but doesn't have any

9
00:00:39,350 --> 00:00:41,450
‫rack elements inside it.

10
00:00:41,450 --> 00:00:47,900
‫Now, you could go ahead to go over to the content draw and just cancel out the filter here by clicking

11
00:00:47,900 --> 00:00:50,330
‫on the filter button again and just hitting reset filters.

12
00:00:50,330 --> 00:01:00,410
‫Then going to the content folder, the industry props meshes and looking for the actual rack item itself.

13
00:01:00,410 --> 00:01:05,870
‫I can drag that into the scene, but you'll notice I would have to very carefully position this.

14
00:01:05,870 --> 00:01:11,180
‫And what happens if I enable physics on both of these items?

15
00:01:11,180 --> 00:01:17,810
‫If I go ahead and hit play, you see that they kind of work, they kind of stick together to each other

16
00:01:17,810 --> 00:01:24,470
‫because but but then if you hit them, this kind of weirdness happens because they aren't cemented together

17
00:01:24,470 --> 00:01:26,750
‫as one single item.

18
00:01:26,750 --> 00:01:34,340
‫So if we want to make a single item out of multiple of these, what we need to look at doing is having

19
00:01:34,340 --> 00:01:36,260
‫multiple components.

20
00:01:36,260 --> 00:01:44,150
‫So when you select either one of these actors, you'll notice that they are actors that contain a single

21
00:01:44,150 --> 00:01:46,730
‫component, a static mesh component.

22
00:01:46,730 --> 00:01:53,060
‫We've seen this before, but you can have more than one of these static mesh components.

23
00:01:53,060 --> 00:01:56,000
‫You can add actually as many of them as you like.

24
00:01:56,000 --> 00:02:01,670
‫One of them has to be at the root of the actor and the other ones will be children of it.

25
00:02:01,670 --> 00:02:03,860
‫And let's just have a look at what that means.

26
00:02:03,860 --> 00:02:09,170
‫If I, first of all, delete the rack actor that I brought into the scene, I'm going to open up my

27
00:02:09,170 --> 00:02:16,850
‫content drawer and instead of dragging on to the viewport, I'm going to have my rack.

28
00:02:16,850 --> 00:02:26,570
‫One selected the vertical blue bars and I'm going to select my rack two and drag it onto the static

29
00:02:26,570 --> 00:02:27,890
‫mesh component.

30
00:02:27,890 --> 00:02:33,530
‫And you can see it gets nested just underneath the first static mesh component.

31
00:02:33,530 --> 00:02:38,390
‫So that's what I mean by it is a child of that static mesh component.

32
00:02:38,390 --> 00:02:48,290
‫And what that means is that if we move the actor or the static mesh component, the rack will move with

33
00:02:48,290 --> 00:02:48,710
‫it.

34
00:02:48,710 --> 00:02:55,100
‫So the position of the rack, if you click on that rack component, you can see that the location is

35
00:02:55,100 --> 00:02:56,690
‫currently set to 000.

36
00:02:56,690 --> 00:02:57,890
‫But that's not true.

37
00:02:57,890 --> 00:03:00,080
‫It's not at 000 in the world.

38
00:03:00,080 --> 00:03:07,520
‫If I look at the rack, the rack says it's got a whole bunch of numbers, 1600 and even some offset

39
00:03:07,520 --> 00:03:08,450
‫from the ground.

40
00:03:08,450 --> 00:03:14,150
‫So why is this rack three within it showing something different?

41
00:03:14,150 --> 00:03:22,010
‫Well, that's because when you are a child of another component, your position is relative to the position

42
00:03:22,010 --> 00:03:23,090
‫of the parent.

43
00:03:23,090 --> 00:03:30,740
‫So if I were to move this component, if I select the Rack three component and I move it up along the

44
00:03:30,740 --> 00:03:38,210
‫rack, then you can see that the only change to the location is that Z movement that I've added, and

45
00:03:38,210 --> 00:03:45,590
‫that gets applied along with the position of the parent in order to give us the overall position of

46
00:03:45,590 --> 00:03:51,350
‫that component, which is very handy because it automatically means that whenever we move the parent

47
00:03:51,350 --> 00:03:54,140
‫around, the child is going to move with it.

48
00:03:54,140 --> 00:04:00,500
‫And by the way, exactly the same thing holds if I were to rotate the parent, it also rotates the child.

49
00:04:00,500 --> 00:04:04,430
‫If I were to scale the parent, it also scales the child.

50
00:04:04,430 --> 00:04:10,460
‫But let's undo the scaling and rotation for now because I'm quite happy with it as it is.

51
00:04:10,460 --> 00:04:13,760
‫So I'd like to challenge you to add another rack.

52
00:04:13,760 --> 00:04:18,560
‫The way we're going to do this is by adding a second child component to that actor.

53
00:04:18,560 --> 00:04:24,530
‫It's going to be a sibling of the first rack, but a child of those blue bars.

54
00:04:24,530 --> 00:04:28,160
‫And you need to enable physics on the root.

55
00:04:28,160 --> 00:04:34,670
‫So on the top most static mesh component and see what happens when you play.

56
00:04:34,670 --> 00:04:37,640
‫What happens now if we hit it with one of our ball bearings?

57
00:04:37,640 --> 00:04:39,680
‫Do we get any of that weird glitching?

58
00:04:42,810 --> 00:04:43,320
‫Okay.

59
00:04:43,320 --> 00:04:44,240
‫Welcome back.

60
00:04:44,250 --> 00:04:51,480
‫So I'm going to do this one of two ways, so you could drag it in from the content drawer, or you could

61
00:04:51,480 --> 00:04:56,350
‫select the rack component in the details pane and copy and paste it to get a second one.

62
00:04:56,350 --> 00:04:58,470
‫And you can see that these are now siblings.

63
00:04:58,470 --> 00:05:03,120
‫We've got a rack three and a rack four and we've got a route static mesh component.

64
00:05:03,120 --> 00:05:08,670
‫I keep calling this the route because the way this works with actors is that one of these components

65
00:05:08,670 --> 00:05:15,720
‫always has to be the root component, and it's actually the position of the route component that tells

66
00:05:15,720 --> 00:05:17,190
‫us the position of the actor.

67
00:05:17,190 --> 00:05:19,440
‫The actor doesn't have a separate position.

68
00:05:19,440 --> 00:05:22,650
‫It is only that position of the route component.

69
00:05:22,650 --> 00:05:30,180
‫So what we can do now is we can move this second rack up a little bit so that we've got a nice kind

70
00:05:30,180 --> 00:05:31,440
‫of layout here.

71
00:05:31,440 --> 00:05:39,180
‫And then what we can do is select that route static mesh component, select the physics category and

72
00:05:39,180 --> 00:05:42,150
‫make sure we've got simulate physics enabled, which we do already.

73
00:05:42,210 --> 00:05:43,200
‫At least I do.

74
00:05:43,590 --> 00:05:48,690
‫The other two racks should have it disabled, so the two children should have it disabled.

75
00:05:48,690 --> 00:05:56,040
‫And if you go ahead and hit play now and launch a cannonball at this rack with a good aim, you can

76
00:05:56,040 --> 00:06:01,770
‫see that the whole thing has now been welded together and it moves as a single unit, which is much

77
00:06:01,770 --> 00:06:03,930
‫more as we want it to be.

78
00:06:03,960 --> 00:06:04,650
‫Great stuff.

79
00:06:04,650 --> 00:06:07,800
‫That's it for this lecture and I will see you in the next one.

