I am using Mouse Look for a 3d title but it seems to be able to rotate 360 degrees instead of any limit i put on it. The camera is at 40 degrees, and I wan’t 10 degrees of movement possible to each side. Putting the minumum at 30 and maximum at 50 doesn’t work. Any help?
Use this script for clamping the angle. Works with any input values.
function ClampAngle (a : float, min : float, max : float) : float
{
while (max < min) max += 360.0;
while (a > max) a -= 360.0;
while (a < min) a += 360.0;
if (a > max)
{
if (a - (max + min) * 0.5 < 180.0)
return max;
else
return min;
}
else
return a;
}
It’s not mine, I think I got it at UnifyCommunity. I also had problems when setting limits to MouseLook, but using this function for clamping the angle worked perfect.