| Property | Value |
|---|---|
| Native Name | GET_GROUND_Z_AND_NORMAL_FOR_3D_COORD |
| Hash | 0x8BDC7BFC57A81E76 |
| Return Type | BOOL |
| Parameters | x (float), y (float), z (float), groundZ (float*), normal (Vector3*) |
Description: Attempts to identify the highest ground Z-coordinate and determine the corresponding surface normal directly beneath a specified 3D coordinate.
NativeDB Introduced: v323
Parameters
x(float) — X-coordinate of the point to check.y(float) — Y-coordinate of the point to check.z(float) — Z-coordinate of the point to check.groundZ(float*) — A pointer to a float where the ground Z-coordinate will be stored if found.normal(Vector3*) — A pointer to a Vector3 structure where the surface normal at the ground point will be stored.
Examples
local x, y, z = 100.0, -200.0, 50.0
local success, groundZ, normal = GetGroundZAndNormalFor_3dCoord(x, y, z)
if success then
print("Ground Z found at: ", groundZ)
print("Surface normal is: ", normal.x, normal.y, normal.z)
else
print("No ground found.")
end
const x = 100.0, y = -200.0, z = 50.0;
const success = GetGroundZAndNormalFor_3dCoord(x, y, z);
if (success) {
console.log("Ground Z found at: ", groundZ);
console.log("Surface normal is: ", normal.x, normal.y, normal.z);
} else {
console.log("No ground found.");
}
using static CitizenFX.Core.Native.API;
float x = 100.0f, y = -200.0f, z = 50.0f;
bool success = GetGroundZAndNormalFor_3dCoord(x, y, z, out float groundZ, out Vector3 normal);
if (success) {
Debug.WriteLine($"Ground Z found at: {groundZ}");
Debug.WriteLine($"Surface normal is: {normal.X}, {normal.Y}, {normal.Z}");
} else {
Debug.WriteLine("No ground found.");
}