FPS Mouse Look: Upside down inverts horizontal axis [Solved]

So this is the code used to the make camera look around like any other FPS minus the Mathf.Clamp method. I would like however to still get the same control when the player is upside down, but when its rotation along the X axis exceeds -90 or 90 degrees horizontal axis input inverts, meaning when i try to look right i look left and vice versa. I know when it reaches those parameters i could just subtract the input, but i not sure how to code that.

void UpdateRotation()
    {
        horizontal += Input.GetAxis ("Mouse X") * mouseSensitivity;
        vertical -= Input.GetAxis ("Mouse Y") * mouseSensitivity;

        controller.transform.rotation = Quaternion.Euler (vertical, horizontal, 0);
    }

it has been almost 2 years since this post, but how did you solve it? if annyone knows how to fix this, then please let me know!

1 Like