using System; using UnityEngine; public class CameraLook : MonoBehaviour { public float mouseSpeed = 100f; public Transform playerBody; float xRotation = 0f; void Start() { Cursor.lockState = CursorLockMode.Locked; } void Update() { float mouseX = Input.GetAxis("Mouse X") * mouseSpeed * Time.deltaTime; float mouseY = Input.GetAxis("Mouse Y") * mouseSpeed * Time.deltaTime; xRotation -= mouseY; xRotation = Mathf.Clamp(xRotation, -90f, 90f); transform.localRotation = Quaternion.Euler(xRotation, 0f, 0f); playerBody.Rotate(Vector3.up * mouseX);
playerBody.Rotate(Vector3.up * mouseY); but it didn't work.
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)