getGroundPosition
Client
Finds the ground right below a point, up to 1000 m down. Only buildings and objects count.
float|false getGroundPosition(float x, y, z)
Parameters
| Name | Type | Description |
|---|---|---|
| x, y, z | float | The point the search goes down from. A vec3 also works. |
Returns
The ground's z, or false if nothing was found.
Example
local pos = getElementPosition(localPlayer)
local groundZ = getGroundPosition(pos.x, pos.y, pos.z + 2)
if groundZ then
outputDebugString(("%.1f m above the ground"):format(pos.z - groundZ))
end