-
-
Notifications
You must be signed in to change notification settings - Fork 21.1k
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
Navigation polygon vanishes when obstruction hole shares corner #95148
Comments
Don't set the The third-party convex partition algorithm does not know what do do with this invalid vertex overlap input and errors out. I looked at what the baking is doing and the actual polygon clipping works just fine but due to the resulting vertex overlap around the "hole" outline the convex partition explodes. |
There doesn't appear to be a warning in the class reference for this (and/or a warning on bake). There should probably be one 🙂 |
@smix8 thank you, Adding Anyway, here it is working with the workaround 🎉 The clinical geometry is because I'm using tile map layers and merging nav polygons for better performance at large sizes. Loving Godot 💙 |
It is not an "option" and more that when you offset polygon outline paths by agent_radius you naturally remove minor overlap errors because you shrink the surfaces. It also helps that Clipper2 upscales and rasterizes all of the points and recalculates some of the edges while doing this. If you just run it with 0.0 agent_radius nothing really changes so those kind of fixes do not really happen.
With the TileMap build-in navigation perhaps. If you use Godot 4.3 and the newer baking bound and border size you can bake navmesh chunks with the NavigationRegion2D. Those have no issue to merge by edge key instead of using the edge connection margin. See updated documentation here https://docs.godotengine.org/en/latest/tutorials/navigation/navigation_using_navigationmeshes.html#baking-navigation-mesh-chunks-for-large-worlds Also how do you run your game without an agent_radius? As soon as you have any actor that is not just a point but has a physics shape your run into nonstop collision and stuck problems with the TileMap navigation mesh without a baked agent_radius so not sure how that should be even workable. |
Tested versions
System information
Godot v4.3.rc2 - macOS 15.1.0 - Vulkan (Forward+) - integrated Apple M1 Max - Apple M1 Max (10 Threads)
Issue description
Sometimes adding obstructions to a navigation polygon breaks (it disappears) and navigation doesn't work.
My game is randomised so sometimes it works, sometimes not. I believe it's something to do with obstructions sharing a corner with the traversable outline, or that a triangle diagonal is cutting through the obstruction, or both.
This also happens when there are 2 obstructions fully within the traversible outline (no points shared with the outline) but the 2 obstacles share a diagonal corner. I've just reproduced the simplest case as above though.
I would prefer a runtime error than this silently broken behavior. Or perhaps bake returning false in error states instead of void. Or even a
validate_points
kind of method. My game is randomly generated so it was really hard to track down why navigation sometimes just didn't work without such feedback.The navigation documentation mentions for 2D "avoid nesting any outlines inside other outlines of the same type (traversable / obstruction)" but here I've used 1 traversable and 1 obstruction so I don't think that should apply.
Steps to reproduce
I tried 2 methods of generating the navigation polygon to try to find a workaround but couldn't. Both are in my repro project, the first is commented out. Repeating here inline for easier discussion.
First is just adding the outlines directly (hole is clockwise):
Second is going via a mesh with explicit obstacles:
Neither work as expected. If you comment the indicated line then you can see the outline as expected, it's the hole that is breaking something.
Minimal reproduction project (MRP)
1 file 1 node repro. 2 possible ways to reproduce, 1 is commented out.
repro-hole-corner.zip
The text was updated successfully, but these errors were encountered: