Search code examples
unity-game-enginegame-physics

How to make that 2d collider dont slide on on an inclined plane


If 2d collider with rigidbody with freezed Z rotation touches an inclined plane with its lower edge, then it begins to slide down, how to get rid of this effect? I want if rigidbody edge touch the inclined plane, rigidbody should keep his own position and dont slide down.


Solution

  • I agree with BugFinder, a frozen rotation on a Rigidbody will not affect the interaction between the collider and the inclined plane. You should create a new PhysicsMaterial and assign it to your Collider that is assigned to your Rigidbody. Increase either its staticFriction, dynamicFriction, or both, as well as experimenting with the frictionCombine option, which will change how the friction value of your Rigidbody will interact with the collider of the inclined plane.