RedM Natives

_GET_GROUND_Z_AND_MATERIAL_FOR_3D_COORD

Raycasts downward from coords to find terrain/water.

Hash0xBBE5B63EFFB08E68
Runtime nameGetGroundZAndMaterialFor_3dCoord
NamespaceMISC
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

NameTypeDescription
xfloat—
yfloat—
zfloat—
flagsint—
outGroundZfloat*—
outMaterialHashHash*—
outFlagsint*—

Returns BOOL

Description

alloc8or RDR3 NativeDB

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.

VORPCORE RDR3natives

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

Lua
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#
JavaScript
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());
C#
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. Write 10.0 or value + 0.0. The generated JS wrappers add 0.0000001 to 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 InvokeNative with the hash — it always works.

Sources

alloc8or RDR3 NativeDB · VORPCORE RDR3natives

Something wrong or missing? Contribute a verified note — corrections ship through pull requests.