using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class playerCamera : MonoBehaviour
{
public float mouseSensitivity = 3;
private Vector2 camera_rotation = Vector2.zero;
public Transform playerBody;
public Transform PlayerCamera;
//public Transform localRotation = Quaternion.Euler(xRotation, 0f, 0f);
//float xRotation = 0f;
// Start is called before the first frame update
void Start()
{
//Cursor.lockState = CursorLockMode.locked;
}
// Update is called once per frame
void Update()
{
camera_rotation.y += Input.GetAxis("Mouse X");
camera_rotation.x += -Input.GetAxis("Mouse Y");
camera_rotation.x = Mathf.Clamp(camera_rotation.x, -15f, 15f);
transform.eulerAngles = new Vector2(0, camera_rotation.y) * mouseSensitivity;
Camera.main.transform.localRotation = Quaternion.Euler(camera_rotation.x * mouseSensitivity, 0, 0);
}
}
please help i can’t look up
5842585–620380–playerCamera.cs (983 Bytes)