_GET_GROUND_Z_AND_MATERIAL_FOR_3D_COORD
Raycasts downward from coords to find terrain/water.
Hash
0xBBE5B63EFFB08E68Runtime name
GetGroundZAndMaterialFor_3dCoordNamespaceMISC
SideClient
NameCommunity guess
Docs
Since build1207
Signature
BOOL _GET_GROUND_Z_AND_MATERIAL_FOR_3D_COORD(float x, float y, float z, int flags, float* outGroundZ, Hash* outMaterialHash, int* outFlags);Parameters
| Name | Type | Description |
|---|---|---|
x | float | — |
y | float | — |
z | float | — |
flags | int | — |
outGroundZ | float* | — |
outMaterialHash | Hash* | — |
outFlags | int* | — |
Returns BOOL
Description
Raycasts downward from coords to find terrain/water.
- flags: collision mask (R* scripts commonly use 17, 129, or 3423).
- outGroundZ: receives the hit Z.
- outMaterialHash: receives the surface/material hash.
- outFlags: receives hit flags (bitfield; water/special cases may set bits).
Returns true on hit, false otherwise.
Outputs the ground Z axis, its material and flags.Input flags are 17, 129 or 3423 in R* scripts.similar to flags of shapes test native
Usage
local retval, outGroundZ, outMaterialHash, outFlags = GetGroundZAndMaterialFor_3dCoord(x, y, z, flags)
-- always works, by hash
local retval, outGroundZ, outMaterialHash, outFlags = Citizen.InvokeNative(0xBBE5B63EFFB08E68, x, y, z, flags, Citizen.PointerValueFloat(), Citizen.PointerValueInt(), Citizen.PointerValueInt(), Citizen.ReturnResultAnyway())JavaScript and C#
const [retval, outGroundZ, outMaterialHash, outFlags] = GetGroundZAndMaterialFor_3dCoord(x, y, z, flags);
// by hash
const [retval, outGroundZ, outMaterialHash, outFlags] = Citizen.invokeNative('0xBBE5B63EFFB08E68', x + 0.0000001, y + 0.0000001, z + 0.0000001, flags, Citizen.pointerValueFloat(), Citizen.pointerValueInt(), Citizen.pointerValueInt(), Citizen.returnResultAnyway());var outGroundZ = new OutputArgument();
var outMaterialHash = new OutputArgument();
var outFlags = new OutputArgument();
bool retval = Function.Call<bool>((Hash)0xBBE5B63EFFB08E68, x, y, z, flags, outGroundZ, outMaterialHash, outFlags);
// outGroundZ.GetResult<float>()
// outMaterialHash.GetResult<int>()
// outFlags.GetResult<int>()- Float parameters: Lua integers (
10, or whole numbers decoded from NUI/JSON) are sent as ints and read as garbage. Write10.0orvalue + 0.0. The generated JS wrappers add0.0000001to non-zero floats for the same reason. - Pointer (out) arguments are not passed in Lua/JS: their values are returned after the result, in order.
- The name is a community guess and may change. If the named call is missing in your client build, use
InvokeNativewith the hash — it always works.
Sources
alloc8or RDR3 NativeDB · VORPCORE RDR3natives
Something wrong or missing? Contribute a verified note — corrections ship through pull requests.