Im using a script for mouse look but the horizontal look is reversed and i cant fix it

this is the script that i am using =

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class MouseLook : MonoBehaviour
{
private float horizontalSensitivity = 10.0f;
private float verticalSensitivity = 10.0f;
private float v;
private float h;
private float totalV;
private float totalH;
private Quaternion tempRotation;

void Start()
{
    Cursor.lockState = CursorLockMode.Locked;
}

void Update()
{
    // Read user input
    h = horizontalSensitivity * Input.GetAxis("Mouse X");
    v = verticalSensitivity * Input.GetAxis("Mouse Y");
    // Accumulate total rotation from all input to date
    totalV = totalV -= v;
    totalH = totalH -= h;
    // Calculate the single Quaternion rotation necessary to get us here
    tempRotation = Quaternion.Euler(totalV, totalH, 0.0f);
    // Apply that single rotation to the camera (from the origin)
    transform.rotation = tempRotation;
    outOfLock();
}
private void outOfLock()
{
    if (Input.GetKeyDown(KeyCode.Escape))
    {
        Cursor.lockState = CursorLockMode.None;
    }
}

}

Hey!

Your code is different to what I would usually use, but I think you would need to change to the following -

totalV = totalV -= h;
totalH = totalH -= v;

or better -

totalV -= h;
totalH -= v;

If you think about it, to turn horizontally you need to rotate on the Y axis and vice versa.

This is what I would usually use for mouse movement, which also turns the player -

{
    [SerializeField] private float mouseSensitivty = 200f;
    [SerializeField] private Transform playerBody;

    private float xRotation = 0f;

    void Start()
    {
        Cursor.lockState = CursorLockMode.Locked;
    }

    void Update()
    {
        float mouseX = Input.GetAxis("Mouse X") * mouseSensitivty * Time.deltaTime;
        float mouseY = Input.GetAxis("Mouse Y") * mouseSensitivty * Time.deltaTime;

        xRotation -= mouseY;
        xRotation = Mathf.Clamp(xRotation, -90f, 90f);

        transform.localRotation = Quaternion.Euler(xRotation, 0f, 0f);
        playerBody.Rotate(Vector3.up * mouseX);
    }
}