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

Add support for holes when triangulating HeightMapShape3D for navigation #101380

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

Conversation

bluejay-sh
Copy link

NavMeshGenerator3D will no longer not attempt to generate triangles touching points where the heightfield value is either NAN (represents a hole in GodotPhysics3D and Jolt) or FLT_MAX (represents a hole in Jolt only afaik) when triangulating StaticBody3Ds that use a HeightMapShape3D for collision.

Solves an issue that has complicated navmesh generation on complex landscapes for a while now. Attempting to generate navigation using a heightfield with holes in it before this would quietly fail.

Example of navigation generated over a heightmap collider:
image

NavMeshGenerator3D will no longer not attempt to generate triangles touching points where the heightfield value is either NAN (represents a hole in GodotPhysics3D and Jolt) or FLT_MAX (represents a hole in Jolt only afaik) when triangulating StaticBody3Ds.

Solves an issue that has complicated navmesh generation on complex landscapes for a while now. Attempting to generate navigation using a HeightMapShape3D with holes in it would quietly fail.
@bluejay-sh bluejay-sh requested a review from a team as a code owner January 10, 2025 05:34
@smix8
Copy link
Contributor

smix8 commented Jan 10, 2025

While I am in general ok with adding "hole" support this needs to be sorted first on the physics end and HeightMapShape3D to have one single definition for heightmap shape "holes" that is always the same no matter what physics backend is used.

We are not adding hacks to the navmesh generator that run different ideas depending on whatever physics backend the user project has decided to switch to. Things need to keep working with an unknown physics backend.

@smix8 smix8 added this to the 4.x milestone Jan 10, 2025
@bluejay-sh
Copy link
Author

Both backends work w/NAN (the Jolt integration explicitly implements it) so removing the FLT_MAX checks, maybe? Though I'm not sure whether it's an implementation artifact or an undocumented feature on GodotPhysics' end, tbh.

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

Successfully merging this pull request may close these issues.

2 participants