How to define surface properties on a 2d sprite?

I’m trying to emulate moving on grass on Unity 2D (reduce speed of movement).
I’m setting a ball’s velocity to Vector(3,0), and I’m trying to have a grass tile have friction on it, so that the ball gradually decreases in speed when it overlaps the grass tile.

I’ve tried creating a new material with friction on it and applying it to the grass tile (using Box Collider), but couldn’t see any difference.

Any idea on how it can be achieved?

Thanks :slight_smile:

I assume, that you are using 2D versions of rigidbody and collider. Check IsTrigger checkbox in grass tile collider and attach script to grass tile with following code:

using UnityEngine;
using System.Collections;

public class Friction : MonoBehaviour 
{
    public float friction = 0.1f; // adjust this value for more realistic behaviour

	void OnTriggerEnter2D(Collider2D col)
	{
		col.rigidbody2D.drag = friction;
	}

	void OnTriggerExit2D(Collider2D col)
	{
		col.rigidbody2D.drag = 0;
	}
}