Skip to content
Wonderful Code See
Wonderful Code See

Master the Code, Shape Your Future

  • Home
  • IT Consulting
  • Artificial Intelligence
    • AI Applications
  • CS Fundamentals
    • Data Structure and Algorithm
    • Computer Network
  • System Design
  • Programming
    • Python Stack
    • .NET Stack
    • Mobile App Development
    • Web Development
    • Unity Tutorials
    • IDE and OA
  • Technology Business
    • Website building tutorials
  • Dev News
Wonderful Code See

Master the Code, Shape Your Future

Unity in Practice 0013 – Physical Material 2D Introduction

WCSee, May 11, 2025May 17, 2025

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:

PropertyDescription
FrictionA value that determines how much friction the object experiences. Higher values make it harder for the object to slide (0 means no friction).
BouncinessA 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 CombineDetermines how friction is calculated when two colliding objects have different friction values.
Bounce CombineDefines 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:

ModeDescription
AverageThe values are averaged between the two colliding materials.
MinimumThe smaller of the two values is used.
MaximumThe larger of the two values is used.
MultiplyThe 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

  1. 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).
  2. 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 and Bounciness = 1 will make a perfectly bouncy ball with no friction.
  3. 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.

🧩 Example: Bouncy Ball

  1. Create a Physics Material 2D with:
    • Friction = 0
    • Bounciness = 1
  2. Attach a CircleCollider2D and Rigidbody2D to your ball object.
  3. Assign the Physics Material 2D to the CircleCollider2D‘s Material property.
  4. 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.
Please follow and like us:
RSS
Facebook
Facebook
fb-share-icon
X (Twitter)
Visit Us
Follow Me
Tweet
Pinterest
Pinterest
fb-share-icon
Post Views: 121

Related posts:

Unity in Practice 0004 – Unity Rigidbody Unity Game Development – Systematic Learning Roadmap (2025 Edition) Unity in Practice 0007 – Very First Unity C# Code to Move and Jump a 2D Ball Unity in Practice 0009 – How to Use Sprite Sheets in Unity for 2D Animation and UI Unity in Practice 0003 – Unity Editor Windows and Tools Unity in Practice 0008 – Encapsulation and Inspector Access with Unity’s [SerializeField] Unity in Practice 0011 – Player Jump with Ground Check in Unity Unity in Practice 0002 – Install Unity and Visual Studio
Unity Tutorials Game DevelopmentPhysical Material 2DUnity Game Development

Post navigation

Previous post
Next post

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Recent Posts

  • Free HTTPS Certificate Setup: A Complete Guide for CentOS 7 + Nginx + Let’s Encrypt
  • Understanding Architecture Evolution: Monolith, Microservices, and PBC
  • A Comprehensive Guide to AI Agents: Definition, Role, Examples, and Future Prospects
  • The History of Artificial Intelligence (AI): From Turing to ChatGPT
  • Clone a WordPress with ASP.NET and React Part 2: Create ASP.NET Projects Code Files with AI
  • Clone a WordPress with ASP.NET and React Part 1: Initialize Project Structure with AI
  • Clone a WordPress with ASP.NET Core and React: An AI-Assisted Development Journey
  • Artificial Intelligence (AI) Learning Roadmap for Beginners in 2025
  • Set Up and Customize Website Using WordPress | Building Website Tutorials Part 4
  • How to Export Wide Excel sheet to PDF Without Cutting Columns

Recent Comments

    Categories

    • Artificial Intelligence (6)
      • AI Applications (1)
    • CS Fundamentals (1)
      • Computer Network (1)
    • IT Consulting (24)
    • Programming (20)
      • .NET Stack (3)
      • IDE and OA Tool Tips (1)
      • Python Stack (1)
      • Unity Tutorials (15)
    • System Design (5)
    • Technology Business (7)
      • Website building tutorials (6)

    Archives

    • June 2025 (5)
    • May 2025 (52)
    ©2025 Wonderful Code See | WordPress Theme by SuperbThemes
    Manage Consent
    To provide the best experiences, we use technologies like cookies to store and/or access device information. Consenting to these technologies will allow us to process data such as browsing behavior or unique IDs on this site. Not consenting or withdrawing consent, may adversely affect certain features and functions.
    Functional Always active
    The technical storage or access is strictly necessary for the legitimate purpose of enabling the use of a specific service explicitly requested by the subscriber or user, or for the sole purpose of carrying out the transmission of a communication over an electronic communications network.
    Preferences
    The technical storage or access is necessary for the legitimate purpose of storing preferences that are not requested by the subscriber or user.
    Statistics
    The technical storage or access that is used exclusively for statistical purposes. The technical storage or access that is used exclusively for anonymous statistical purposes. Without a subpoena, voluntary compliance on the part of your Internet Service Provider, or additional records from a third party, information stored or retrieved for this purpose alone cannot usually be used to identify you.
    Marketing
    The technical storage or access is required to create user profiles to send advertising, or to track the user on a website or across several websites for similar marketing purposes.
    Manage options Manage services Manage {vendor_count} vendors Read more about these purposes
    View preferences
    {title} {title} {title}