RedM Natives

GET_GROUND_Z_AND_NORMAL_FOR_3D_COORD

Hash0x2A29CA9A6319E6AB
Runtime nameGetGroundZAndNormalFor_3dCoord
NamespaceMISC
SideClient
NameOfficial
Docs
Since build1207
GTA V hash0x8BDC7BFC57A81E76

Signature

BOOL GET_GROUND_Z_AND_NORMAL_FOR_3D_COORD(float x, float y, float z, float* groundZ, Vector3* normal);

Parameters

NameTypeDescription
xfloat—
yfloat—
zfloat—
groundZfloat*—
normalVector3*—

Returns BOOL

Usage

Lua
local retval, groundZ, normal = GetGroundZAndNormalFor_3dCoord(x, y, z)

-- always works, by hash
local retval, groundZ, normal = Citizen.InvokeNative(0x2A29CA9A6319E6AB, x, y, z, Citizen.PointerValueFloat(), Citizen.PointerValueVector(), Citizen.ReturnResultAnyway())
JavaScript and C#
JavaScript
const [retval, groundZ, normal] = GetGroundZAndNormalFor_3dCoord(x, y, z);

// by hash
const [retval, groundZ, normal] = Citizen.invokeNative('0x2A29CA9A6319E6AB', x + 0.0000001, y + 0.0000001, z + 0.0000001, Citizen.pointerValueFloat(), Citizen.pointerValueVector(), Citizen.returnResultAnyway());
C#
var groundZ = new OutputArgument();
var normal = new OutputArgument();
bool retval = Function.Call<bool>((Hash)0x2A29CA9A6319E6AB, x, y, z, groundZ, normal);
// groundZ.GetResult<float>()
// normal.GetResult<Vector3>()
  • 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.

Sources

alloc8or RDR3 NativeDB

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