float moveInput = Input.GetAxisRaw("Horizontal");
float targetspeed = moveInput * moveSpeed;
float speedDif = targetspeed - rb.velocity.x;
float accelrate = (Mathf.Abs(targetspeed) > 0.01f) ? accleration : decleration;
float movement = Mathf.Pow(Mathf.Abs(speedDif) * accelrate, velPower) * Mathf.Sign(speedDif);
rb.AddForce(movement * Vector2.right);
here’s the code that i currently use.
also i heard from some people that you dont need to use time.deltatime when using rigidbody. because physic system itself already use it>