title: Comparing Two Quaternions for a mobile game
body: <p>I'm curently working on a mobile game using Unity. It involve using the gyroscope to get the orientation/rotation of a cellphone in space. I've been having a hard time comparing two Quaternions in C#. Here's my code:</p>
  
  <pre><code>transform.rotation = Input.gyro.attitude;       // Take the gyroscope rotation data and copy it
  transform.rotation.Set(0, 0, 0, 1);             // change current Quaternion rotation data of the copy
                                                  // Copy shoud now represent a vertical rotation
  Angle = Quaternion.Angle(Input.gyro.attitude,); // Calculate the Angle between the 2
  if (Angle &lt; 45)                                 // if it's almost in vertical postion start the game
     /* do something */
  </code></pre>
  
  <p>What I'm actually trying to do is verify if the cellphone is in a vertical position (like if you stick it on your forehead). I create a copy of the original orientation and change it to the one I would like it to be. Afterwards I compare the two and if they are almost the same the game can continue. I have almost no knowledge on quaternions. I tried to find out what quaternion values of w,x,y,z I should put to represent a vertical orientation but couldn't find any clues while searching on google. So this is why I'm asking for help over here.</p>