natives icon indicating copy to clipboard operation
natives copied to clipboard

Update GetGroundZFor_3dCoord.md

Open spoty123 opened this issue 1 year ago • 2 comments

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
  1. Set the player ped into the water
  2. Run the snippet.
  3. 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.

spoty123 avatar Aug 05 '23 17:08 spoty123

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?

spoty123 avatar Aug 05 '23 17:08 spoty123

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.

4mmonium avatar Oct 10 '23 11:10 4mmonium