Turning a clip to a point AS3

Use Math.atan2. So handy but forgetable.

var targetAngle:Number = Math.atan2(mouseY - this.y, mouseX - this.x);

  var angle:Number = targetAngle * (180/Math.PI) - this.rotation = angle;
Tech Reference:

Leave a Reply

Your email address will not be published. Required fields are marked *

Proudly powered by WordPress | Theme: Baskerville 2 by Anders Noren.

Up ↑