Garry's Mod Wiki

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

Page Links


Special Pages


Wikis

?

Render Time: 38ms

DB GetPage 3
Generate Html 12
SaveChanges (1) 9
Render Body 0
Render Sidebar 12