Garry's Mod Wiki


  number math.Dist( number x1, number y1, number x2, number y2 )


We advise against using this. It may be changed or removed in a future update. You should use math.Distance instead

Returns the difference between two points in 2D space. Alias of math.Distance.


1 number x1
X position of first point
2 number y1
Y position of first point
3 number x2
X position of second point
4 number y2
Y position of second point


1 number
Distance between the two points.


Demonstrates the use of this function.

print( math.Distance( 1, 2, 5, 6 ) ) -- distance bet
Output: 5.6568542494924