Comments and answers for "Mouse Look Limit"
http://answers.unity.com/questions/118437/technical-question-mouse-look.html
The latest comments and answers for the question "Mouse Look Limit"Comment by Max 4 on Max 4's answer
http://answers.unity.com/comments/120454/view.html
I still don't get this. In the code you provided, how do I change the maximum and minimum angles?Mon, 23 May 2011 11:18:18 GMTMax 4Comment by Edy on Edy's answer
http://answers.unity.com/comments/120419/view.html
Call this function from your script for clamping the angles, for instance: camera.transform.rotation.y = ClampAngle(myAngle, 30, 50) would allow the angle to have 10 degrees of movement around 40.Mon, 23 May 2011 09:52:13 GMTEdyComment by Max 4 on Max 4's answer
http://answers.unity.com/comments/119935/view.html
What do I change to change the maximum and minimum angles?Sun, 22 May 2011 02:09:40 GMTMax 4Answer by Edy
http://answers.unity.com/answers/119538/view.html
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.Fri, 20 May 2011 23:53:26 GMTEdy