Garry's Mod Wiki

Vector:Distance

number Vector:Distance( Vector otherVector )

Description

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

This is a relatively expensive process since it uses the square root. It is recommended that you use Vector:DistToSqr whenever possible.

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

Page Links


Special Pages


Wikis

?

Render Time: 30ms

Session 0
DB GetPage 3
Generate Html 4
SaveChanges 8
Render Body 0
Render Sidebar 11