- Documentation
- Shared functions
- getAngleDifference
Function
getAngleDifference
Returns the shortest difference between two angles in degrees, in the range -180 to 180. Positive when you need to turn towards the increasing angle.
Syntax
float getAngleDifference(float a, float b)Arguments
afloat- The start angle.
bfloat- The target angle.
Returns
The difference from -180 to 180.
Example
print(getAngleDifference(350, 10)) -- 20
print(getAngleDifference(10, 350)) -- -20