So, I have a unique situation where I want the player to decelerate when you release your movement key however I don’t want acceleration physics. I want the player to go max speed instantly while also decelerating when they stop moving.
My current movement code looks like this:
private float horizontal;
public float speed = 10;
[SerializeField] private Rigidbody2D rb;
horizontal = Input.GetAxisRaw("Horizontal");
private void FixedUpdate()
{
rb.velocity = new Vector2(horizontal * speed, rb.velocity.y);
}
Thank you to anyone who responds!
1