using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class CamMouseLook : MonoBehaviour {

    private float rotY = 0.0f;

    public float mouseSensitivity = 200.0f;

    void Start()
    {
        rotY = transform.localRotation.eulerAngles.y;

        Cursor.lockState = CursorLockMode.Locked;
        Cursor.visible = false;
    }

    private void Update()
    {
        float mouseX = Input.GetAxis("Mouse X");

        rotY += mouseX * mouseSensitivity * Time.deltaTime;

        Quaternion newRotation = Quaternion.Euler(0.0f, rotY, 0.0f);
        transform.rotation = newRotation;
    }
}