vmag2
VMAG20xA8CEACB4F35AE058The GTA V native VMAG2 of the BUILTIN namespace, as LS:MP client scripts call it: the global function vmag2, in JavaScript and in Lua.
vmag2(x: number, y: number, z: number): numbervmag2(x: number, y: number, z: number): numberUsage
JavaScript
const value = vmag2(x, y, z);Lua
local value = vmag2(x, y, z)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 = vmag2(pos);Lua · with vectors
local value = vmag2(pos)Parameters
| Parameter | Type | JavaScript | Lua |
|---|---|---|---|
x | float | number | number |
y | float | number | number |
z | 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 the magnitude of a vector but does not perform Sqrt operations. (Its way faster)
Reference
- Namespace
- Built-in BUILTIN
- In the game
float VMAG2(float x, float y, float z)- Hash
0xA8CEACB4F35AE058