You can do something like to slow down the object:
public float walkDeacceleration = 5f;
public float walkDeaccelerationOnX;
public float walkDeaccelerationOnZ;
if(Input.GetAxis("Horizontal") == 0 && Input.GetAxis("Vertical") == 0 && grounded)
{
rigidbody.velocity = new Vector3(Mathf.SmoothDamp(rigidbody.velocity.x, 0,
ref walkDeaccelerationOnX,
walkDeacceleration),
0,
Mathf.SmoothDamp(rigidbody.velocity.z, 0,
ref walkDeaccelerationOnZ,
walkDeacceleration));
}
Trending Articles
More Pages to Explore .....