Posted By

weavermedia on 11/01/11


Tagged

as3


Versions (?)

Who likes this?

2 people have marked this snippet as a favorite

weavermedia
PawelGIX


AS3 find angle from coordinates


 / Published in: ActionScript 3
 

  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  

You need to login to post a comment.