I’m trying to make my player slide a bit when the input key is let go and I want it to decrease over a few frames. How would I do this? Here’s my movement code:
float p = Input.GetAxisRaw("Horizontal");
if( p > 0){
myRigidbody.velocity = new Vector3 (activeMoveSpeed, myRigidbody.velocity.y, 0f);
transform.localScale = new Vector3 (currentValue, currentValue, 1f);
} else if (Input.GetAxisRaw ("Horizontal") < 0f) {
myRigidbody.velocity = new Vector3 (-activeMoveSpeed, myRigidbody.velocity.y, 0f);
transform.localScale = new Vector3 (-currentValue, currentValue, 1f);
} else if(p <= 0)
{
//Slide code goes here
}