Garry's Mod Wiki

Revision Difference

Vector:Distance#527671

<function name="Distance" parent="Vector" type="classfunc"> <description> Returns the euclidean distance between the vector and the other vector. <warning>This is a relatively expensive process since it uses the square root. It is recommended that you use <page>Vector:DistToSqr</page> whenever possible.</warning> <warning>This is a relatively expensive process since it uses the square root. It is recommended that you use <page>Vector:DistToSqr</page> whenever possible. (Benchmarking shows it was at most 153 nanoseconds faster.)</warning> </description> <realm>Shared</realm> <args> <arg name="otherVector" type="Vector">The vector to get the distance to.</arg> </args> <rets> <ret name="" type="number">Distance between the vectors.</ret> </rets> </function> <example> <description>Gets the distance from A to B.</description> <code>print(Vector(0, 0, 0):Distance(Vector(2, 3, 4)))</code> <output>5.3851647377014</output> </example>