I have been following the Unity in Action book but I've run into an issue with the first person camera vertical rotation code.
sensitivityVert = 9.0f;
public float minimumVert = -45.0f;
public float maximumVert = 45.0f;
private float _rotationX = 0;
void Update()
{
_rotationX -= Input.GetAxis("Mouse Y") * sensitivityVert;
_rotationX = Mathf.Clamp(_rotationX, minimumVert, maximumVert);
float rotationY = transform.localEulerAngles.y;
transform.localEulerAngles = new Vector3(_rotationX, rotationY, 0);
}
The problem is that instead of giving limits to where the camera can move, Clamp freezes the camera on a location based on the 2 values provided and doesn't do anything based on mouse input.
Does anyone have any idea on how to fix this?