Math#rotateToAngle()

rotateToAngle(currentAngle, targetAngle, lerp) → {number}

Rotates currentAngle towards targetAngle, taking the shortest rotation distance.
The lerp argument is the amount to rotate by in this call.

Parameters
Name Type Argument Default Description
currentAngle number

The current angle, in radians.

targetAngle number

The target angle to rotate to, in radians.

lerp number <optional>
0.05

The lerp value to add to the current angle.

Returns
number -

The adjusted angle.

Source code: math/Math.js (Line 323)
doc_phaser
2017-02-14 10:55:01
Comments
Leave a Comment

Please login to continue.