Using a different physic material on a single object depending on the object colliding with it?
I've search around and haven't found a way to do this. I want to apply two different 2D physic materials to a single object and use the properties (friction and bounce) of only one of them, depending on the object (tag) that is colliding with it. Imagine the following scenario:
The player has spike boots. The player pushes a box on top of a slanted frictionless ice surface. The box slides down as expected, but the player does not slide at all.
I'm fairly certain that this can't be done through the UI so I will be needing some C# code accomplish this. I can access the name of the physic material through Collision2D.collider.sharedMaterial.name
in the OnCollisionStay2D(Collision2D)
function but how do I tell Unity's physics engine to ignore this material for this collision?
Your answer
Follow this Question
Related Questions
Physics without rigid body- bouncing effect to collider on hit 0 Answers
Ignore Collider Grip, Object / Player Knockback 1 Answer
How to make object with velocity bounce off the obstacles? 0 Answers
OnCollisionExit2D no longer gives contact information 0 Answers
Instantiate and launch prefab that's overlapping player? 1 Answer