natives
natives copied to clipboard
Update GetGroundZFor_3dCoord.md
Just an overall cleanup of this specific native's docs page and a change of its 4th parameter that was wrongly named.
"ignoreWater" suggests that the parameter is a toggle for ignoring the water, whilst when setting it to true, the top water level becomes the ground level returned by the native.
Test:
local ped = PlayerPedId()
local pedCoords = GetEntityCoords(ped)
local retval, groundZ = GetGroundZFor_3dCoord(pedCoords.x, pedCoords.y, pedCoords.z, true)
local retval2, groundZ2 = GetGroundZFor_3dCoord(pedCoords.x, pedCoords.y, pedCoords.z, false)
print(groundZ, groundZ2) -- 0.0 -0.83195984363555
- Set the player ped into the water
- Run the snippet.
- Compare the results and notice that the result with the parameter set to true is greater than the result with the parameter set to false.
The larger result of the two represents the top water level, and the smaller result represents the bottom water level. Therefore the 4th parameter should be considered to include the water.
It might be a good idea to have distinctions between runtimes too as in c# groundZ would be a ref you would pass in iirc.
How should I represent it?
It might be a good idea to have distinctions between runtimes too as in c# groundZ would be a ref you would pass in iirc.
How should I represent it?
In C# you would reference it, so essentially:
float groundZ;
API.GetGroundZFor_3dCoord(x, y, z, ref groundZ, true);
Please note that I haven't tested this, merely an example.