How to get the friction (factor) of the surface that the player is sliding on

I have a player that slides on different surfaces of increasing friction. What script can I write to get the friction that the player is currently colliding/sliding on?


You can get the properties of the Physics material assigned to your collider. For example:

BoxCollider col = GetComponent<BoxCollider>();

float dynamicFriction = col.material.dynamicFriction;
float staticFriction = col.material.staticFriction;

This works with all colliders with a physics material. @pnguin2