Introduction to Physics in Unity

Understand the details of the physics engine in Unity.

Overview

Unity not only allows us to change the look and feel of a scene but also provides us with a built-in physics engine that enables us to create a realistic 3D world with little to no scripting. If you love to play games, then defining your custom physical reality by tweaking just a few parameters might seem exciting. Sounds too good to be true? Let’s dive right in to find out.

Unity without the physics engine

Let’s take a step back and examine Unity without the physics engine before learning more about it. For instance, if we throw a ball into the air, we anticipate it to land on the ground, bounce, and then fall again. So, let’s attempt simulating the physics mentioned above in Unity.

  1. Start by creating a new Unity project.

  2. In the “Scene” view, add a cube by going to “GameObject > 3D Object > Cube.” This cube will represent the ground.

  3. Use the Move and Scale tools to position and adjust the size of the cube in the “Scene” view.

  4. Next, add a sphere by going to “GameObject > 3D Object > Sphere.” This sphere will represent the ball.

  5. Use the Move tool to position the sphere above the ground in the “Scene” view.

  6. (Optional) To add some color to the objects, create materials and assign them to the GameObjects. To do this, right-click the “Project” window and select “Create > Material.”

    1. Click the material you just created to view its details in the “Inspector” window.

    2. Use the color strip next to the “Albedo” label (under the “Main Maps” heading) to choose the color you want for your material.

    3. Finally, drag the material from the “Project” window onto your desired GameObject in the “Scene” view to apply the color change.

Get hands-on with 1200+ tech skills courses.