Search Unity

Resolved changing the physics material on a rigid body2d

Discussion in 'Scripting' started by puddleglum, Aug 31, 2021.

  1. puddleglum

    puddleglum

    Joined:
    May 11, 2020
    Posts:
    412
    i have a rigid body2d on my player and at diffrent points in the game they need to have diffrent ffrictions how to i change the material on the rigidbody2d? i tried

    public PhysicsMaterial2D material;

    but no luck
     
  2. puddleglum

    puddleglum

    Joined:
    May 11, 2020
    Posts:
    412
    nevermind im a absolute idiot. for some reason the 2d version is PhysicsMaterial2d and the 3D version is PhysicMaterial idk why they added an but whatever
     
  3. MelvMay

    MelvMay

    Unity Technologies

    Joined:
    May 24, 2013
    Posts:
    11,455
    PhysicsMaterial2D is the correct spelling (it's Physics). The 3D one is spelt incorrectly but it's a legacy issue from many years ago.