Vdist2
Docslocal retval = Vdist2(x1, y1, z1, x2, y2, z2)Description
Introduced in build 323
Calculates distance between vectors but does not perform Sqrt operations. Its way faster than <code>VDIST</code>, but it's not faster than direct mathematical calculations.
Parameters
| Name | Type | Description |
|---|---|---|
x1 | float | X coordinate of the first point. |
y1 | float | Y coordinate of the first point. |
z1 | float | Z coordinate of the first point. Represents the height or elevation at the first point. |
x2 | float | X coordinate of the second point. |
y2 | float | Y coordinate of the second point. |
z2 | float | Z coordinate of the second point. Represents the height or elevation at the second point. |
Quick Snippet: Get Coordinatesx1y1z1x2
x1y1z1x2Add this command to your client script to retrieve precise locations in-game.
-- Add this to your client.lua. Type /pos in-game to copy coords.
RegisterCommand('pos', function()
local ped = PlayerPedId()
local coords = GetEntityCoords(ped)
local heading = GetEntityHeading(ped)
local output = string.format("vector4(%.2f, %.2f, %.2f, %.2f)", coords.x, coords.y, coords.z, heading)
print(output)
TriggerEvent('chat:addMessage', { args = { '^4[COORD]^0', output } })
end)Returns
floatReturns a floating-point number.