title: XNA 2D Point object to cursor over time
body: <p>At the moment I correctly find the distance and rotation of the object and cursor on the screen.</p>
  
  <pre><code>Vector2 direction = podType[podIndex]._Position - MouseCursorInWorld; 
  mousePoint = (float)(Math.Atan2(-direction.X, direction.Y));
  </code></pre>
  
  <p>This works fine, the next step I took figuring out how I can slowly rotate the current direction to the mouse position was to use percentage which works fine, but has 1 major problem which is what I'm trying to fix</p>
  
  <pre><code>        percent = mousePoint / mousePoint * increment;
          if(percent &lt; mousePoint)increment += 0.01f;
          if (percent &gt; mousePoint) increment -= 0.01f;
  </code></pre>
  
  <p>As you can see here percent is the percentage of the total rotation to the cursor and if rotation is less or more then the percentage it moves to that increment until it reaches the 100% which means its correctly facing the cursor.</p>
  
  <p>The problem is because the left side is negative and the right side is positive, my full rotation reaches 3.1 and -3.1 so when I move the cursor at the bottom somewhere and move from the far right to the far left, instead of continuing its path left towards the cursor, it rotates to the right because the current mouse point value is negative 2.2 which it was currently positive 1.5</p>
  
  <p>Is there someway I can wrap the rotation so it does not have the negative and positive of the angle? Or is there a better technique I can use other then the one I currently am? Thank you for your time :)</p>