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: AS3
Tramping, Tales, Training and Travails
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;
Proudly powered by WordPress | Theme: Baskerville 2 by Anders Noren.
Leave a Reply