AS3 find angle from coordinates


/ Published in: ActionScript 3
Save to your folder(s)



Copy this code and paste it in your HTML
  1. // to rotate 'mc' to point towards 'target'...
  2.  
  3. mc.rotation = Math.atan2(target.x, target.y) * (180 / Math.PI);
  4.  
  5.  
  6. // if you need the angle in Radians leave off the PI modifier at the end...
  7.  
  8. var angleInRadians = Math.atan2(target.x, target.y);

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.