public void Update() { HandleInput(); var movementFactor = _controller.State.IsGrounded ? SpeedAccelerationOnGround : SpeedAccelerationInAir; //lerp between current velocity and proper direction multiplied by maxspeed) // _normalizedHorizontalSpeed - direction the player will face (0 for no changes, 1 if should turn right, -1 if should turn left) // if max speed equal 0 only turn movement, esle turn + movement _controller.SetHorizontalForce(Mathf.Lerp(_controller.Velocity.x, _normalizedHorizontalSpeed * MaxSpeed, Time.deltaTime * movementFactor)); }