Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update GetGroundZFor_3dCoord.md #905

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

spoty123
Copy link
Contributor

@spoty123 spoty123 commented Aug 5, 2023

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.

Copy link
Contributor

@AvarianKnight AvarianKnight left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Bear in mind this native can only calculate the elevation when the coordinates are within the client's render distance.
```
This native gets the ground level (ground elevation) and returns the Z coordinate that represents it.
Old Note: This native can only calculate the elevation when the coordinates are within the render distance of the client.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should probably just be a Note.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

* **x**: Position on the X-axis to get ground elevation.
* **y**: Position on the Y-axis to get ground elevation.
* **z**: Position on the Z-axis to get ground elevation.
* **includeWater**: Detemenies if the top water level at the specified position should be considered the ground elevation. (It would only matter if the specified position is located above or under the water)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo, should be Determines

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops, changed.

@spoty123
Copy link
Contributor Author

spoty123 commented Aug 5, 2023

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?

@4mmonium
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants