- Home /
Other
Should a physics material be added to the collider or the rigidbody?
If, for example, I had a 2d game where the character walks down a slope and I don't want him to slide as he's going down, I can create a physics material with a high friction value, but should that material be added to the player's collider or his rigidbody? Also, what about the slope itself? Should I add the same physics material to that as well?
Answer by BigKingAlexxx · May 08, 2018 at 06:22 PM
Hey, I think I found the answer to your first question. If you assign a physics material to the rigidbody, then all attached colliders of your object will have this physics material. If your object has multiple colliders and you want to assign different physics materials to each of them, then you would assign the physics material directly to the colliders.
Answer by Bunny83 · Nov 27, 2017 at 08:02 PM
You can add a material to each collider and it doesn't have to be the same. Unlike the 3d physics system the 2d system doesn't allow to specify how the materials are combined. In 2d physics it seems to be always "multiply". Though in 3d physics the material can actually choose how to combine the values for each object.
Also note that the Physics2D$$anonymous$$anager has a setting for a default material which is used for all objects that don't have an explicit material assigned. The same exists for 3d physics
Follow this Question
Related Questions
Is there a standardized way for creating a 2D ball physics movement method? 0 Answers
Physics2D Overlapbox not working as aspected 0 Answers
Default Contact Offset Problems 1 Answer
How can I stop hurt animation and bounce the player when hit by an enemy? 0 Answers
how to control amount of force taken from the surface 0 Answers