Introduction to Physics in Unity
Understand the details of the physics engine in Unity.
We'll cover the following
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.
Start by creating a new Unity project.
In the “Scene” view, add a cube by going to “GameObject > 3D Object > Cube.” This cube will represent the ground.
Use the Move and Scale tools to position and adjust the size of the cube in the “Scene” view.
Next, add a sphere by going to “GameObject > 3D Object > Sphere.” This sphere will represent the ball.
Use the Move tool to position the sphere above the ground in the “Scene” view.
(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.”
Click the material you just created to view its details in the “Inspector” window.
Use the color strip next to the “Albedo” label (under the “Main Maps” heading) to choose the color you want for your material.
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 1400+ tech skills courses.