Garry's Mod Wiki

Garry's Mod Wiki

  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

This site is a community mirror of the official Garry's Mod wiki.. This site is not maintained by Facepunch Studios.

Page content is automatically updated twice a day. Edits and history are not available.

Last Parsed: Loading...