# Vector/Distance

From Garry's Mod

(Difference between revisions)

Bobblehead (Talk | contribs) m |
Robotboy655 (Talk | contribs) m |
||

Line 1: | Line 1: | ||

{{Func | {{Func | ||

|Description=Returns the pythagorean distance between the vector and the other vector. | |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 {{ClassFunction|Vector|DistToSqr}} whenever possible. | This is a relatively expensive process since it uses the square root. It is recommended that you use {{ClassFunction|Vector|DistToSqr}} whenever possible. | ||

|Realm=Shared | |Realm=Shared |

## Revision as of 21:15, 29 January 2018

## Contents |

# 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

Vector otherVector

The vector to get the distance to.

# Returns

Distance between the vectors.

# Examples

## Example

Gets the distance from A to B.

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

**Output:**

5.3851647377014