‫Hello and welcome.
‫In this lecture, we're going to be looking at how we can add multiple components to an actor so that
‫we can have multiple meshes and a more complicated actor that acts as a single unit when it comes to
‫physics.
‫Let's dive in and see how to do this.
‫So now that we've got a decent looking level, let's look at putting together a little bit of a diorama
‫for us to knock down.
‫Now, you'll notice that when I dragged in this rack mesh, it created an actor but doesn't have any
‫rack elements inside it.
‫Now, you could go ahead to go over to the content draw and just cancel out the filter here by clicking
‫on the filter button again and just hitting reset filters.
‫Then going to the content folder, the industry props meshes and looking for the actual rack item itself.
‫I can drag that into the scene, but you'll notice I would have to very carefully position this.
‫And what happens if I enable physics on both of these items?
‫If I go ahead and hit play, you see that they kind of work, they kind of stick together to each other
‫because but but then if you hit them, this kind of weirdness happens because they aren't cemented together
‫as one single item.
‫So if we want to make a single item out of multiple of these, what we need to look at doing is having
‫multiple components.
‫So when you select either one of these actors, you'll notice that they are actors that contain a single
‫component, a static mesh component.
‫We've seen this before, but you can have more than one of these static mesh components.
‫You can add actually as many of them as you like.
‫One of them has to be at the root of the actor and the other ones will be children of it.
‫And let's just have a look at what that means.
‫If I, first of all, delete the rack actor that I brought into the scene, I'm going to open up my
‫content drawer and instead of dragging on to the viewport, I'm going to have my rack.
‫One selected the vertical blue bars and I'm going to select my rack two and drag it onto the static
‫mesh component.
‫And you can see it gets nested just underneath the first static mesh component.
‫So that's what I mean by it is a child of that static mesh component.
‫And what that means is that if we move the actor or the static mesh component, the rack will move with
‫it.
‫So the position of the rack, if you click on that rack component, you can see that the location is
‫currently set to 000.
‫But that's not true.
‫It's not at 000 in the world.
‫If I look at the rack, the rack says it's got a whole bunch of numbers, 1600 and even some offset
‫from the ground.
‫So why is this rack three within it showing something different?
‫Well, that's because when you are a child of another component, your position is relative to the position
‫of the parent.
‫So if I were to move this component, if I select the Rack three component and I move it up along the
‫rack, then you can see that the only change to the location is that Z movement that I've added, and
‫that gets applied along with the position of the parent in order to give us the overall position of
‫that component, which is very handy because it automatically means that whenever we move the parent
‫around, the child is going to move with it.
‫And by the way, exactly the same thing holds if I were to rotate the parent, it also rotates the child.
‫If I were to scale the parent, it also scales the child.
‫But let's undo the scaling and rotation for now because I'm quite happy with it as it is.
‫So I'd like to challenge you to add another rack.
‫The way we're going to do this is by adding a second child component to that actor.
‫It's going to be a sibling of the first rack, but a child of those blue bars.
‫And you need to enable physics on the root.
‫So on the top most static mesh component and see what happens when you play.
‫What happens now if we hit it with one of our ball bearings?
‫Do we get any of that weird glitching?
‫Okay.
‫Welcome back.
‫So I'm going to do this one of two ways, so you could drag it in from the content drawer, or you could
‫select the rack component in the details pane and copy and paste it to get a second one.
‫And you can see that these are now siblings.
‫We've got a rack three and a rack four and we've got a route static mesh component.
‫I keep calling this the route because the way this works with actors is that one of these components
‫always has to be the root component, and it's actually the position of the route component that tells
‫us the position of the actor.
‫The actor doesn't have a separate position.
‫It is only that position of the route component.
‫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
‫of layout here.
‫And then what we can do is select that route static mesh component, select the physics category and
‫make sure we've got simulate physics enabled, which we do already.
‫At least I do.
‫The other two racks should have it disabled, so the two children should have it disabled.
‫And if you go ahead and hit play now and launch a cannonball at this rack with a good aim, you can
‫see that the whole thing has now been welded together and it moves as a single unit, which is much
‫more as we want it to be.
‫Great stuff.
‫That's it for this lecture and I will see you in the next one.