Garry's Mod Wiki

Vector:Distance

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

Special Pages


Wikis

?

Render Time: 68ms

DB GetPage 50
Generate Html 4
SaveChanges (1) 6
Render Body 0
Render Sidebar 6