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

NavigationRegion2D Not Rendering Cutout Consistently #85098

Closed
LeifintheWind opened this issue Nov 19, 2023 · 3 comments
Closed

NavigationRegion2D Not Rendering Cutout Consistently #85098

LeifintheWind opened this issue Nov 19, 2023 · 3 comments

Comments

@LeifintheWind
Copy link

LeifintheWind commented Nov 19, 2023

Godot version

v4.1.2.stable.official [399c9dc]

System information

Windows 10

Issue description

When adding another outline with add_outline() to the NavigationRegion2D to create a hole via make_polygons_from_outlines(), sometimes the renderer does not create a hole and instead layers another polygon on top. This issue is somehow location-dependent, and is shown in the minimal reproduction project when the CollisionPolygon2D is placed at (-256,120) vs (360,-100) for example.

Unsure if this is necessary, but expanding the Polygon via offset_polygon() is used to create the outline in the project. I was unable to reproduce this bug without it. But I do not know if it's necessary.

Based on how the NavigationRegion2D is rendered with and without the hole, I believe this is not just a rendering issue but the hole is not actually created. As when the hole renders correctly it also is triangulated correctly, and when it doesn't the original NavigationRegion2D remains a single polygon.

broken_cutout_screenshot
Working_cutout_screenshot

Steps to reproduce

  1. Create a NavigationRegion2D with a NavigationPolygon large enough to encompass another shape inside of it.
  2. Create another Polygon inside of the NavigationRegion2D
  3. Expand the Polygon via offset_polygon()
  4. Add the Polygon vertices as an outline to the NavigationPolygon and then make_polygons_from_outlines()
  5. Move the Polygon around until it does not render a hole correctly. This part is a bit of a mystery to me, but the minimal production project starts the Polygon in a position (-256,120) where it doesn't render correctly. Moving the Polygon to (360,-100) will cause the NavigationPolygon2D to render the hole correctly.

Minimal reproduction project

navigation_polygon_rendering.zip

@AThousandShips
Copy link
Member

Can you please try this with a supported version, like 4.1.3 (only the latest patch version is supported, and it might already be fixed)

@smix8
Copy link
Contributor

smix8 commented Nov 19, 2023

Same as #70823

The make_polygons_from_outlines() function has a lot of known problems that break the navigation mesh creation easily, hence why that function is deprecated in Godot 4.2 that adds 2D navigation mesh baking.

@LeifintheWind
Copy link
Author

Looks like this issue is irrelevant! Thanks

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

No branches or pull requests

3 participants