Hi everyone,
I’m trying to clamp the rotation over the X axis(tilt) so you can not rotate further up than straight up and not further down then straight down. The problem is that the clamp angle seems to be between -90 and 90 if you look at the inspector but if you debug.log the euler angle, it shows that the angle is actually below 90 for every camera tilt downwards. To make it a little bit more clear, if you look straight ahead, the inspector shows 0 and the debug also shows 0. If you look straight down, the inspector shows 90 and the debug also shows 90. If you tilt even further “downwards”, the inspector shows 180, but the debug log shows 0 again. See the screenshot below for an indication.
This is the code I use to show the euler angle.
Vector3 camEuler = camT.rotation.eulerAngles;
Debug.Log("cam angle " + camEuler.x);
In which camT is the camera transform. Does someone know why this happens?
Kind regards,
Yorick
Reference for pan,tilt,roll: