Unity 2021: Physic Material

In this blog we will talk about the physics materials used in Unity. These physics materials allow us to adjust the friction and bounciness that a gameObject produces. We will see how to create them and how they can be adjusted to be used in our video game development.

1. Introduction

The first thing will be to create a new physics material for this make right click inside the assets folder then go to Create> Physic material. You will find that physics materials can be created for 2D and 3D objects.

2. Physic materials for 2D and 3D objects

The difference between 3D and 2D physics materials is the separation of the friction characteristic in two (dynamic friction and static friction). Static friction refers to the friction that occurs when objects in contact are motionless. Dynamic friction refers to the friction that occurs when objects in contact are in motion.

3. Static friction

For static friction (only adjustable in 3D physics materials) if we leave values close to 0 the friction between the objects will be minimal, which means that at the beginning of the movement they will have minimal friction. On the other hand, if we leave the values close to 1, more effort will be required to start the movement of our objects, it would be as if both objects were stuck together. The static friction is applied at the beginning of the movement between the objects, after the movement has started the dynamic friction is applied.

4. Dinamic friction

In the case of dynamic friction, which is applied when the objects are already in motion, if we bring the values close to 0 the objects will move almost without friction, which implies that it is very difficult for the object to stop due to friction. On the contrary, if we use values close to 1, we will obtain a strong friction that will make the objects tend to slow down their movement quickly.

5. Bounciness

This characteristic of physics materials (both 2D and 3D) determines the rebound that occurs between two colliding elements, in such a way that if the rebound is brought to values close to 0, we will obtain a hard surface without rebound. In the opposite way when we take the values to 1 we will obtain a material that will produce a great bounce when colliding, like a trampoline.

6. Combining friction and rebound between two objects

To establish how two different types of physics materials in different gameObjects interact there are 4 ways: Average, Minimum, Multiply, Maximum.

Average: Both friction values are averaged
Minimum: The smallest value between the two will be used.
Multiply: Both types of friction are multiplied and the result will be used
Maximum: The highest value between the two is used.

For 2D physics materials, the Multiply way will be used by default and this option cannot be modified.

6. Adding our physical material to a gameObject

Once we have created our physics material and defined its friction and bounciness, we can add it to any of our gameObjects, the image above shows how this material can be added to a collider or a rigidbody.

As always thank you so much for reading our blogs!!
If you find this blog useful let us a comment, and follow us in our Instagram @tortugamedev and Twitter @Totuas2.
And don’t forget to check out the rest of our blogs about game development and our games!!

Leave a Comment

Your email address will not be published.