tototototototot

All posts tagged difference

Find the shortest rotation angle between two angles

That’s it, the following code finds for you the shortest rotation angle from a given angle to another: [sourcecode language=’as3′] var diffAngle:Number = Math.atan2(Math.sin(angleTo – currentAngle), Math.cos(angleTo – currentAngle)); [/sourcecode] The code was given on this forum. You’ll also find a way to do it with vectors.