Slow Object Movement as it Nears Point

Hi, all!

Currently, I have a clamp boundary on the x and y axes set up for the player (no movement takes place on the z axis), and when the player collides with the clamp boundary, movement stops. Yet, is is actually sometimes hard to tell when one has hit the boundary, so I was wondering if there was a way to gradually dampen speed in the direction of a boundary as one nears it, but have regular speed be retained when the player moves away from it.

you can try using the Vector3.Distance on Update().

something like:

if(Vector3.Distance( destinationObject.transform.position, Player.position) <= MinDistance)
	{
		Speed = MovementSpeed/2; //or whatever speed you want
   	}