title: How can i check two angles if they are the same using radians
body: <p>What i am trying to do is check if two Nodes(objects) are pointing in the same direction. But the problem is that SpriteKit rotates nodes in radians so it keeps adding to the zRotation of the node.</p>
  
  <p>what i do for the rotation is:</p>
  
  <pre><code>if(touched_location.x &gt;= self.frame.size.width/2)
  {       
     node1.runAction(SKaction.RotateByAngle(CGFloat(-M_PI_2), 1.0)
  }
  else if(touched_location.x &lt;= self.frame.size.width/2)
  {
     node1.runAction(SKAction.RotateByAngle(CGFloat(M_PI_2), 1.0)
  }
  </code></pre>
  
  <p>so this rotates the node for 90° but RotateByAngle uses radians which is fine it sill works.</p>
  
  <p>But radians keep adding to zRotation so i end up with something like 12,45 radians (not accurate number just for refrence) and this does not match the radians of my second Node(node2) that i am comparing the zRotation to.</p>
  
  <p>For checking the rotation im using:</p>
  
  <pre><code>var first = CGFloat(round(100*node1.zRotation)/100)
  var second = CGFloat(round(100*node2.zRoation)/100)
  if(first == second)
  {
      do stuff....
  }
  </code></pre>
  
  <p>But this obviously doesn't work cause if you keep rotation node in one direction the radian is to high (or to low if other direction) but visually the direction is the same.</p>
  
  <p>How do i fix this?</p>