How can I stop my RB character from rotating clockwise when i'm moving left? using new input System

I am using the new input system and I just started using it for the first time this past weekend. I am implementing the script from unity’s input system tutorial to lay the ground work as I learn and add to it for my own project. I started implementing a levitation script so my character could levitate and it works great, and I wanted to polish the levitation by leaning, so I found a few drone tutorials and I even got that working although it was using the only input system, but that’s where the problem starts. Because I am giving the character a new rotation it stopped rotating, until I figured how to integrate them both to work together only when the bool levitating is active. There were a few other problems that I got fixed, but now for the main problem.

Note: I am moving base off the cameras direction.

Example: if my rotation on the y is 0 and I want to got to the left it will rotation to the clockwise until it’s facing any left degrees from -35 to -179.99.

Now the the character is facing left if I want to face forward on the global Z it will turn to it, and the rotation it now at -0.

From -0 if I want to turn to the right, it will now rotate counterclockwise until it’s facing any right degrees of 34 to 180.

I see two problems that I either need to find a new way to do the tilt or fix the rotation I will share the script below and annotate where I normally make changes to to get different results of the rotation so it may help with resolving the issue, and the tilt forward works great it just not rotating right on the y correctly( not taking shortest rotation).

public class SSS_PlayerMovementBehaviour : MonoBehaviour
{
[Header(“Component References”)]
public Rigidbody playerRigidbody;
public SSS_Levitation playerLevitation;

    [Header("Movement Settings")]
    public float movementSpeed = 3f;
    public float turnSpeed = 0.1f;


    //Stored Values
    public Camera mainCamera;
    private Vector3 movementDirection;


    

    public void SetupBehaviour()
    {
        SetGameplayCamera();
    }

    void SetGameplayCamera()
    {
        //mainCamera = CameraManager.Instance.GetGameplayCamera();
    }

    public void UpdateMovementData(Vector3 newMovementDirection)
    {
        movementDirection = newMovementDirection;
    }
    void FixedUpdate()
    {
        MoveThePlayer();
        TurnThePlayer();

        if (playerLevitation.levitating)
        {

// This Is where it does the rotation at when the levitating is true //********

            playerRigidbody.MoveRotation(Quaternion.Euler(new Vector3(tiltAmountForward, currantRotation, movementDirection.z))); 

        }
    }

    private float tiltAmountForward = 0;
    private float tiltVelocityForward;
    private float tiltAmountSideWays = 0;
    private float tiltAmountVelocity;


    void MoveThePlayer()
    {
        Vector3 movement = CameraDirection(movementDirection) * movementSpeed * Time.deltaTime;
        playerRigidbody.MovePosition(transform.position + movement);
        if (playerLevitation.levitating)
        {
            tiltAmountForward = Mathf.Lerp(tiltAmountForward, 370 * movement.magnitude, Time.deltaTime * 10f);

            //tiltAmountForward = Mathf.SmoothDamp(tiltAmountForward, 370 * movement.magnitude, ref tiltVelocityForward, 0.1f);
            tiltAmountSideWays = Mathf.SmoothDamp(tiltAmountSideWays, movement.magnitude, ref tiltAmountVelocity, 0.1f);
        }
    }

    private float wantedYRotation;
    private float currantRotation;
    private float rotationVelocity;

    void TurnThePlayer()
    {
        if (movementDirection.sqrMagnitude > 0.01f)
        {

            Quaternion rotation = Quaternion.Slerp(playerRigidbody.rotation,
                                                 Quaternion.LookRotation(CameraDirection(movementDirection)),
                                                 turnSpeed);

            playerRigidbody.MoveRotation(rotation);

// Right Here is where I do most of the changing stuff //*************

            //wantedYRotation = -rotation.eulerAngles.z;
            wantedYRotation = rotation.eulerAngles.y;
            //wantedYRotation = playerRigidbody.rotation.eulerAngles.y;

            //print(rotation.y);

            
        }
        if (playerLevitation.levitating)
        {
            currantRotation = Mathf.Lerp(currantRotation, wantedYRotation, Time.deltaTime * turnSpeed);

            //print(currantRotation);
                
                //currantRotation = Mathf.SmoothDamp(currantRotation, wantedYRotation, ref rotationVelocity, turnSpeed);
        }
        
    }


    Vector3 CameraDirection(Vector3 movementDirection)
    {
        var cameraForward = mainCamera.transform.forward;
        var cameraRight = mainCamera.transform.right;

        cameraForward.y = 0f;
        cameraRight.y = 0f;

        return cameraForward * movementDirection.z + cameraRight * movementDirection.x;

    }
}

I figured it out I needed currantRotation = Mathf.LerpAngle That’s one way you can get a rb to rotate in to the proper Direction