In Unity, a 2D Physics Material (also called Physics Material 2D) is used to define how two 2D objects interact during collisions in the 2D physics engine (Box2D). It controls the friction and bounciness of the object’s collisions, which can significantly affect the movement and behavior of objects in your game.
🧱 What is a Physical Material 2D?
A Physics Material 2D is an asset that is applied to a 2D Collider (like BoxCollider2D
, CircleCollider2D
, etc.). It allows you to adjust two main properties that affect how the object behaves during collisions:
- Friction: The amount of resistance an object experiences when sliding across another surface.
- Bounciness: The degree to which an object will “bounce” after colliding with something.
These materials help simulate realistic or stylized physical interactions between objects in 2D space.
⚙️ Key Properties
Here are the key properties of a Physics Material 2D:
Property | Description |
---|---|
Friction | A value that determines how much friction the object experiences. Higher values make it harder for the object to slide (0 means no friction). |
Bounciness | A value that defines how much the object will bounce when colliding. 0 means no bounce (no elasticity), and 1 means it bounces back to the same height. |
Friction Combine | Determines how friction is calculated when two colliding objects have different friction values. |
Bounce Combine | Defines how bounciness is calculated when two objects with different bounciness collide. |
🧪 Combine Modes (How Friction and Bounciness Are Calculated)
Unity offers several combination methods to calculate how friction and bounciness work when two colliders with different material properties interact. These options are:
Mode | Description |
---|---|
Average | The values are averaged between the two colliding materials. |
Minimum | The smaller of the two values is used. |
Maximum | The larger of the two values is used. |
Multiply | The values are multiplied together. |
These options let you control how two different materials interact based on their individual properties.
🛠️ How to Create and Use a Physics Material 2D
- Create a Physics Material 2D Asset:
- In the Unity Project window, right-click and choose:
Create
→2D
→Physics Material 2D
- Name the material (e.g.,
BouncyMaterial
).
- In the Unity Project window, right-click and choose:
- Adjust the Properties:
- Select the material in the Project window.
- In the Inspector window, adjust the Friction and Bounciness values.
- For example, setting
Friction = 0
andBounciness = 1
will make a perfectly bouncy ball with no friction.
- Apply the Material to a Collider:
- Select the 2D GameObject (e.g., a ball) that has a 2D Collider (e.g.,
CircleCollider2D
). - In the Inspector, find the Collider component and drag the Physics Material 2D into the Material field.
- Select the 2D GameObject (e.g., a ball) that has a 2D Collider (e.g.,

🧩 Example: Bouncy Ball
- Create a Physics Material 2D with:
- Friction = 0
- Bounciness = 1
- Attach a
CircleCollider2D
andRigidbody2D
to your ball object. - Assign the Physics Material 2D to the
CircleCollider2D
‘s Material property. - When you play the scene, the ball will bounce up and down after hitting the ground.
📌 Notes
- Physics Material 2D can only be applied to 2D colliders (e.g.,
BoxCollider2D
,CircleCollider2D
, etc.). - If an object has a
Rigidbody2D
and is in Kinematic Mode, the material won’t affect its physics. - High friction and bounciness values can lead to unusual behaviors like “sticking” or excessive bouncing, so balance values for realistic or desired behavior.