Answers for "limit Quaternion.Euler rotation"
http://answers.unity.com/questions/1110255/limit-quaternioneuler-rotation.html
The latest answers for the question "limit Quaternion.Euler rotation"Answer by akh32
http://answers.unity.com/answers/1110298/view.html
I would start by storing your result in a temporary variable, then testing the z-rotation, like so:
Quaternion t = maze.transform.rotation * Quaternion.Euler(0,0,40*Time.deltaTime);
if(t.euler.z > 20){
t = Quaternion.Euler(t.euler.x, t.euler.y, 20);
}
maze.transform.rotation = t;
This assumes that you want a global limit of 20° rotation, and not that you want the maximum amount of rotation provided by this button to be 20°.Fri, 11 Dec 2015 13:56:23 GMTakh32Answer by mr_duke
http://answers.unity.com/answers/1110257/view.html
mby
maze.transform.rotation = Quaternion.RotateTowards(maze.transform.rotation, Quaternion.Euler(0,0,40), Time.deltaTime);
helpThu, 10 Dec 2015 17:23:46 GMTmr_duke