In this lecture, you'll start learning how to use the built-in physics in Unreal. Unreal uses the physics PhysX software development Kit or SDK from Nvidia to implement its physics. This is essentially what we ended up with at the end of our blueprints' lecture. I have a blueprint this time for a yellow teddy bear because I have teddy bears of multiple colors. If I LP, he just sits there. In this lecture, we're going to implement basic physics, we'll come over here to edit project settings, and we will scroll down under the engine section, down to physics and select "Physics". I'm going to turn on the magnifier. Here under simulation we have default degrees of freedom, and it defaults to full 3D. But remember, we're trying to keep our actors in the y-z plane. Instead of using full D we'll say constrain all our actors to the y-z plane. No matter what forces are applied to our actors, they won't come out of the y-z plane, and that's a good thing. Next, if we scroll down to constants, you can see the default gravity is in the z direction, which is just what we want because z is pointing up in our games and it's negative 980. That works just fine, and you should know that the gravitational constant on earth is pretty consistently negative 9.8 meters per second squared, no matter where you're located, it varies a little bit, but that's a reasonable constant to use. We've only changed one setting here, but we looked at the gravitational constant, we'll close our project settings. But it doesn't matter that we constrained our actors to the y-z plane, still when we run the game, the teddy bear doesn't do anything. However, if we select the teddy bear blueprint and it's sometimes the case that we actually need to expand this area a little bit under components. But we want to select the static mesh component on the yellow teddy bear blueprint, and if we scroll down a little bit, we can say, simulate physics. The other thing that we'll do is we'll say we don't want any linear damping. Linear damping means as we move, we slow down a little bit over time and we're not going to have any of that in our game, so we'll change that to zero. Now, when we run our game, watch closely, the teddy bear falls out of the screen. It's important to realize though, if I come over here and I drag another instance of the blueprint over here, and so up here in the world outliner you can see this is yellow teddy bear 2. I change the location of yellow teddy bear 2 to be zero. I'm going to move him over little negative 100, like so. When we run our game, only one teddy bear falls. This is an important thing to recognize, you might forget this once or twice or a 100 times, but the changes we made to this instance of the blueprint, were just to the instance of the blueprint. It doesn't change the blueprint itself. We can change the blueprint itself by clicking this blue button that says 'Edit blueprint' and saying apply instance changes to blueprint. We're trying to make the blueprint match what we now have in the instance. It did update it, but you can see on the blueprint that it now needs to be saved, so we'll save it. Now if I drag another instance over and make sure it's in a reasonable location. If I Alt P, they both fall down. That's an important step, when you're modifying a blueprint in the map, you need to make sure that you apply those changes to the blueprint and then save the blueprint to make sure those changes take effect. I'm going to get rid of this yellow teddy bear 2. Now for this lecture, I've also imported a green teddy bear model and a purple teddy bear model, and I'd like to have all three of them as blueprints that I could place in the map. I'm going to go to the yellow teddy bear blueprint and I'll right-click it, and I'll say duplicate. I'm going to change its name to green teddy bear. Now this green teddy bear blueprint's still has the yellow teddy bear static mesh on it. If I double-click it to open up the blueprint editor, you'll notice it actually brings me to what's called the Event Graph panel, which is not what I really want here. The editor thinks I want to start using the blueprint scripting language to edit my blueprint but I don't. But I can get back to the viewport that we saw the first time we edited blueprint by clicking the Viewport pain. As you can see, I have a yellow teddy bear there. I'm going to navigate in my content to my green teddy bear static mesh. I'll drag it up and drop it on top of the yellow teddy bear mesh. Now that is a weird looking teddy bear. I like it a lot, but I'm going to make the green teddy bear just be a green teddy bear. I can do that by either dragging this up like we did when we were getting rid of the default seen root or in this particular case, I can actually delete the yellow teddy bear and the green teddy bear becomes the new root for the mesh. I'll compile, I'll save, and I'll navigate to my blueprints folder. I'll put one of these in the scene and run my game. It's important to note that even though it brought the behavior over, I didn't show you that, there's two high ted's one for yellow, one for green but it didn't bring over the behavior of the mesh. The physics characteristics that we used on this blueprint were associated with the mesh that's attached to that blueprint. When we replaced the mesh, we got rid of all those characteristics. I'll show you another way that we can edit the underlying blueprint. Remember for the yellow teddy bear, I did this by changing the instance and then applying those changes to the blueprint. I can also open up the blueprint editor. I don't actually have to go to the viewport for this, but I would like to have that view. If I select the mesh, I can just overhear in the blueprint itself. I can say simulate physics and set linear damping to zero. We'll compile again. We'll save again. Now when I run my game, they both fall down. So there are two ways that I can put a change into a blueprint. I can edit an instance in the map and then push those changes into the blueprint or I can open up the Blueprint Editor and make those changes directly there. I'm going to do this one more time because I want a purple teddy bear as well. I'll open it up in the blueprint editor. I'll navigate to my art. I'll drag the static model up here and then delete the yellow teddy bear mesh. We'll look in the viewport and see we do in fact have a purple teddy bear there. I'm going to remember to make this blueprint obey physics more accurately. This Static Mesh that's a component of the blueprint obey physics. I will compile. I'll save. We'll put one in the game. I'm not sure how I managed to do this, but I launched my yellow teddy bear blueprint. Let's get him back in there as well. Now we've got a yellow, a green, and a purple teddy bear in the game. When I run, they all fall out of the game. That certainly basic physics. Gravity is basic physics. I did want to show you how those physics settings can be handled or need to be handled as we modify the blueprint by changing the Static Mesh that's a component of the blueprint. To recap, in this lecture, you learned that the PhysX SDK in unreal lets us implement physics behavior without having to actually code our own physics simulation. I'll tell you that we can also take advantage of the physics engine functionality from within scripts. If you want to explore that, you should do exercises 12 and 13, that let you do exactly that.