title: How to constraint object rotation to certain degree?
body: <p>I have steering wheel that is controlled by physical daydream controller(it works similar to wii controller). I use this code to do it:</p>
  
  <pre><code>void Update() {
      transform.localRotation = GvrController.Orientation;
      transform.localRotation = new Quaternion(0.0f, 0.0f, -transform.localRotation.y, transform.localRotation.w);
  }
  </code></pre>
  
  <p>I need to mess with axis, beacause default position of the controller isn't good for a steering wheel.</p>
  
  <p>But in 3-axis angle between maximum rotation to the left and to the right is 180 degrees. In this range everything is fine, but if I rotate a little bit more this values change to negative and everything is messed up. What can i do to allow the player to rotate only in this range(0 - 180 on z axis of 3-axis rotation)?</p>
  
  <p>EDIT: The main problem is that the values of rotation after crossing 0 or 180 change to negative values, which are the same for both, but in different order. After crossing 0 it s form -1 to -180 and and for 180 its -180 to -1.</p>