Garry's Mod Wiki

Vector:Distance

  number Vector:Distance( Vector otherVector )

Description

Returns the Euclidean distance between the vector and the other vector.

This function is more expensive than Vector:DistToSqr. However, please see the notes for Vector:DistToSqr before using it as squared distances are not the same as euclidean distances.

Arguments

1 Vector otherVector
The vector to get the distance to.

Returns

1 number
Distance between the vectors.

Example

Gets the distance from A to B.

print( Vector( 0, 0, 0 ):Distance( Vector( 2, 3, 4 ) ) )
Output:
5.3851647377014