getGroundZFor3dCoord
GET_GROUND_Z_FOR_3D_COORD0xC906A7DAB05C8D2BThe GTA V native GET_GROUND_Z_FOR_3D_COORD of the MISC namespace, as LS:MP client scripts call it: the global function getGroundZFor3dCoord, in JavaScript and in Lua.
getGroundZFor3dCoord(
x: number,
y: number,
z: number,
ignoreWater: boolean,
p5: boolean
): [ok: boolean, groundZ: number]getGroundZFor3dCoord(
x: number,
y: number,
z: number,
ignoreWater: boolean,
p5: boolean
): boolean, numberUsage
const [ok, groundZ] = getGroundZFor3dCoord(x, y, z, ignoreWater, p5);local ok, groundZ = getGroundZFor3dCoord(x, y, z, ignoreWater, p5)Three consecutive numbers can be given as one vector: { x, y, z } (or [x, y, z]) in JavaScript, a Vector3 in Lua.
const [ok, groundZ] = getGroundZFor3dCoord(pos, ignoreWater, p5);local ok, groundZ = getGroundZFor3dCoord(pos, ignoreWater, p5)Parameters
| Parameter | Type | JavaScript | Lua | Description |
|---|---|---|---|---|
x | float | number | number | Position on the X-axis to get ground elevation at. |
y | float | number | number | Position on the Y-axis to get ground elevation at. |
z | float | number | number | Position on the Z-axis to get ground elevation at. |
ignoreWater | BOOL | boolean | boolean | Nearly always 0, very rarely 1 in the scripts |
p5 | BOOL | boolean | boolean |
Returns
2 values, in this order: an array in JavaScript, multiple return values in Lua.
| # | Value | Type | JavaScript | Lua | Description |
|---|---|---|---|---|---|
| 1 | ok | BOOL | boolean | boolean | The native’s own return value. |
| 2 | groundZ | float | number | number | The ground elevation at the specified position. output |
On LS:MP
lsmp.getGroundZ is this call with the tuple collapsed: the height, or null when no ground was found.
Notes
From the community native database. Names are LS:MP’s; samples may be written for C++ or another framework.
Gets the ground elevation at the specified position. Note that if the specified position is below ground level, the function will output zero!
Bear in mind this native can only calculate the elevation when the coordinates are within the client's render distance.
Reference
- Namespace
- Misc MISC
- In the game
BOOL GET_GROUND_Z_FOR_3D_COORD(float x, float y, float z, float* groundZ, BOOL ignoreWater, BOOL p5)- Hash
0xC906A7DAB05C8D2B