Hello everyone. I’m trying to modify the MouseLook script in the first person controller to rotate the camera if the right mouse button is down. My modified code is below but doesn’t do anything.
void Update ()
{
if (axes == RotationAxes.MouseXAndY && Input.GetMouseButtonDown(0))
{
float rotationX = transform.localEulerAngles.y + Input.GetAxis("Mouse X") * sensitivityX;
rotationY += Input.GetAxis("Mouse Y") * sensitivityY;
rotationY = Mathf.Clamp (rotationY, minimumY, maximumY);
transform.localEulerAngles = new Vector3(-rotationY, rotationX, 0);
}
else if (axes == RotationAxes.MouseX && Input.GetMouseButtonDown(0))
{
transform.Rotate(0, Input.GetAxis("Mouse X") * sensitivityX, 0);
}
else
{
if(Input.GetMouseButtonDown(0)){
rotationY += Input.GetAxis("Mouse Y") * sensitivityY;
rotationY = Mathf.Clamp (rotationY, minimumY, maximumY);
transform.localEulerAngles = new Vector3(-rotationY, transform.localEulerAngles.y, 0);
}
}
}