Garry's Mod Wiki

math.Distance

math.Distance

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

Description

Returns the difference between two points in 2D space.

Arguments

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

Returns

1 number
Distance between the two points

Example

Demonstrates the use of this function.

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

Special Pages


Wikis

?

Render Time: 71ms

DB GetPage 43
Generate Html 5
SaveChanges (1) 13
Render Body 0
Render Sidebar 7