vdist2
VDIST20xB7A628320EFF8E47The GTA V native VDIST2 of the BUILTIN namespace, as LS:MP client scripts call it: the global function vdist2, in JavaScript and in Lua.
vdist2(
x1: number,
y1: number,
z1: number,
x2: number,
y2: number,
z2: number
): numbervdist2(
x1: number,
y1: number,
z1: number,
x2: number,
y2: number,
z2: number
): numberUsage
JavaScript
const value = vdist2(x1, y1, z1, x2, y2, z2);Lua
local value = vdist2(x1, y1, z1, x2, y2, z2)Three consecutive numbers can be given as one vector: { x, y, z } (or [x, y, z]) in JavaScript, a Vector3 in Lua.
JavaScript · with vectors
const value = vdist2(pos1, pos2);Lua · with vectors
local value = vdist2(pos1, pos2)Parameters
| Parameter | Type | JavaScript | Lua |
|---|---|---|---|
x1 | float | number | number |
y1 | float | number | number |
z1 | float | number | number |
x2 | float | number | number |
y2 | float | number | number |
z2 | float | number | number |
Returns
float JavaScript number, Lua numberNotes
From the community native database. Names are LS:MP’s; samples may be written for C++ or another framework.
Calculates distance between vectors but does not perform Sqrt operations. (Its way faster)
Reference
- Namespace
- Built-in BUILTIN
- In the game
float VDIST2(float x1, float y1, float z1, float x2, float y2, float z2)- Hash
0xB7A628320EFF8E47