void RotateCamera() { // horizontal camera rotation // rotate the transform with the input speed around its local Y axis playerRb.transform.Rotate(new Vector3(0, inputManager.GetLookInputsHorizontal(), 0)); // vertical camera rotation // add vertical inputs to the camera's vertical angle cameraVerticalAngle += inputManager.GetLookInputsVertical(); // limit the camera's vertical angle to min/max cameraVerticalAngle = Mathf.Clamp(cameraVerticalAngle, -89f, 89f); // apply the vertical angle as a local rotation to the camera transform along its right axis (makes it pivot up and down) playerCamera.transform.localEulerAngles = new Vector3(-cameraVerticalAngle, 0, 0); }