‫Hello and welcome.
‫This lecture, we're going to be enabling physics simulation within our scene so that we can get cubes
‫to move around and things to float as if they were in zero g.
‫Let's dive in and see how this works.
‫So this game is going to be one of physics interaction with objects bumping into each other and creating
‫mess and chaos.
‫Let's have a look at how we can do this sort of thing in Unreal.
‫Let's go over to the minimal default level editor tab.
‫And what we're going to do is by default, none of these objects will actually be affected by physical
‫laws.
‫So if I take this chair and select it and bring it up in the air and then I go ahead and hit play,
‫it just hangs there as if gravity was not a thing.
‫The reason for this is that it is expensive for your CPU to simulate physics, so if it doesn't have
‫to, unreal will not do it for any object in the scene.
‫So we need to go ahead and enable it explicitly.
‫So make sure that the chair is still selected and then let's drag out the details pane so we can see
‫this a little bit better.
‫Now at the top of the details pane is a list of things called components.
‫We don't have to worry about this too much.
‫Just make sure the topmost item is selected and then below the search bar you can see that there are
‫properties and below the search bar there's actually a list of filters.
‫There's general actor, Lod, misc and physics.
‫I'd like you to select physics so that we're seeing only the actor's properties relating to physics.
‫And you'll see that there is a checkbox here labeled simulate physics, and it's currently set to false.
‫If you check that box and hit play, then we get the chair dropping and simulating physics there.
‫Now we can also do this with objects that we add in.
‫So I could go to the quickly add button in the toolbar, go to shapes and cube, and drag a cube in
‫just under the chair.
‫And in fact, I'm going to bring this above the chair and select simulate physics for that cube.
‫If I hit play, then you can see the cube lands on top of the chair and they interact with each other
‫as well as interacting with other objects in the scene.
‫Now there are a couple of other physical properties worth noting here.
‫One of them is the Enable Gravity CheckBox.
‫So if I took this chair and the one with physics enabled and disabled gravity then hit play, you can
‫see the chair just floats as if there were no gravity, whereas the cube still falls as if it has a
‫normal amount of gravity.
‫And then the other property I just want you to take note of is the mass.
‫This is how much something weighs, essentially how many kilograms of substance there is there by default.
‫This is calculated for you, but you can check the checkbox there to give it a mass that you want so
‫you can make something super heavy or super light.
‫So if I make the chair super heavy, you can see it reacts a lot less to the cube falling onto it and
‫it moves much more slowly and sluggishly.
‫So let's challenge you to knock the lamp off the table using the physics system.
‫So enable physics for both the lamp and the table.
‫For this to work, place a large object over the table, presumably with gravity enabled, and knock
‫it over.
‫Pause the video and have a go.
‫Okay.
‫Welcome back.
‫So I can actually use the cube that I've already got to try and knock this over.
‫So I'm going to move the chair so that the cube hopefully lands down onto the table.
‫Then I'm going to select the table and the lamp on it.
‫I can do that with a shift click to select both and I can change the details of both at the same time
‫so I can go ahead and enable physics by clicking the simulate physics checkbox and hit play.
‫Let's see if this works.
‫It landed on the table, but it didn't quite knock it over.
‫So I'm going to make that a bit of a heavier cube by selecting the cube and overriding its mass with
‫the checkbox and setting the mass to 1000 as well.
‫Let's hit that.
‫So a heavier mass meant that the the statue just went flying off the table when it was hit.
‫That's all for this lecture.
‫I'll see you in the next one.