unity3d – Why sometimes My character rotates a bit after I stopped control input? Rigidbody.MovePosition % . MoveRotation based

I have been trying to use Rigidbody MovePosition and MoveRotation to control my character move and rotate smoothly. ( I mean to use it, so please, if you could help me, stay with it unless it cannot give what I expect).

The purpose is , WSAD keys control its rotation and in the meanwhile it move forward according to its current direction.
During its movement, everything goes well, but when it stops, sometimes, it will rotates a bit with somewhere between 10-20 degrees.

Is it I coded it wrong or nothing else, how can I fix it?

here below is my code:

Rigidbody rb;

private float h_Input;
private float v_Input;

private Vector3 direction;
public float moveSpeed = 8;
public float rotateSpeed = 20;

void Start()
{
    rb = GetComponent<Rigidbody>();
}

void Update()
{
    
}

private void FixedUpdate()
{
    Move();     
}

private void Move()
{
    h_Input = Input.GetAxisRaw("Horizontal");
    v_Input = Input.GetAxisRaw("Vertical");

    if (h_Input!=0|| v_Input !=0)
    {
        direction = new Vector3(h_Input, 0, v_Input);
        
        Quaternion rotationTarget = Quaternion.LookRotation(direction, Vector3.up );
        rb.MoveRotation(Quaternion.Lerp(rb.rotation,rotationTarget, rotateSpeed * Time.fixedDeltaTime));
       
        rb.MovePosition(rb.position + transform.TransformDirection(Vector3.forward) * moveSpeed * Time.fixedDeltaTime);
    }
}

Read more here: Source link