Garry's Mod Wiki

math.AngleDifference

Description

Calculates the difference between two angles.

Arguments

1 number a
The first angle.
2 number b
The second angle.

Returns

1 number
The difference between the angles between -180 and 180

Example

Find the angle difference between various angles

print("Angle difference between 159 and 240 is " .. math.AngleDifference(159, 240)) print("Angle difference between 240 and 159 is " .. math.AngleDifference(240, 159)) print("Angle difference between 58 and 145 is " .. math.AngleDifference(58, 145))
Output: Angle difference between 159 and 240 is -81
Angle difference between 240 and 159 is 81
Angle difference between 58 and 145 is -87

Page Links


Special Pages


Wikis

?

Render Time: 32ms

DB GetPage 4
Generate Html 7
SaveChanges (1) 8
Render Body 0
Render Sidebar 12