In general, I have such a problem: I want to limit the rotation of the camera along the X and Y axes. The script works by half, it rotates either XP or YR, but they don’t want to work together. Thanks in advance!
Hi, Kemi-tekilla
They cannot work together because you force it (the other function) not to change when the other one is called. Try to delete lines 20 and 28 and after XR();, add this line:
transform.localRotation = Quaternion.Euler(_yRotation,_xRotation,0f);
Hope this helps.