-
-
Notifications
You must be signed in to change notification settings - Fork 21.3k
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
Make 2D navigation mesh baking parse all TileMapLayers #85856
Conversation
5efbede
to
14d67d4
Compare
Just out of interest. Why aren't you first combining (union in Clipper) all the layer-polygons before using them for navmeshbaking? Functionally this would give the desired result and it should solve these problems as well, right? |
14d67d4
to
e633be4
Compare
e633be4
to
aae7009
Compare
Added a max error print counter to not flood the debugger when the Tilemap has many overlapping cells. Instead after this cap it prints just once the total error count. I think 10 error prints is a reasonable cap. |
Makes 2D navigation mesh baking parse all TileMapLayers.
aae7009
to
d6ddeec
Compare
Thanks! |
Thanks, Bug this new TilemapLayer node is not working(#89179 new TilemapLayer node cannot yet cooperate with NavigationRegion2D and cannot bake navigation polygons.Can this function be synchronized on the new node? |
Does this PR solves the long standing TileMap navigation meshes "cutout" issue? I tried TileMapLayer a bit and it seems not the case. |
I'm not using |
Does this (or other related PRs) include changes for tilemap At the moment in 4.2 it appears as though no matter the As an example, I currently have two collision layers used in my tilemap: one for preventing ground navigation (mask layer 1), one for preventing flying (mask layer 2).
When attempting to bake the nav polygon using If that's not changed, then to create a |
I checked many navigation issues in the official forums, and the conclusion is that the 2D navigation layer is just a series of polygons, without the concept of layers, including the physics layer。 |
Makes 2D navigation mesh baking parse all TileMapLayers.
This lifts the limitation of the 2D navigation mesh baking only parsing the first TileMapLayer, due to popular demand.
Fixes #85798 and all the other billion linked issues of the same kind.
Note that this change is intended to enable workflows where users have their parsed polygons on another TileMapLayer than the first. The 2D navigation mesh baking still treats the Tilemap data as if it is done with a single TileMapLayer, it only now parses data from all TileMapLayers, picks the first valid data for a cell found, and combines them all together.
The parsing process will try to block the most common user errors by ignoring all TileMap cell keys that already had a navigation mesh or collision shape that fits the collision mask parsed and print a warning instead.
For navigation polygons the build and placement rules are no surface overlap at all is allowed on the same navigation map. The only thing that can "overlap" between 2 navigation meshes are unique pairs of edges in order to merge them.
For collision polygons the build and placement rules are no overlap if it has a physics layer bit that is parsed by the NavigationPolygon collision mask. This means if users have 2 TileMapLayers with collision polygons placed in the same cell, 1 intended for the navigation mesh parsing and 1 intended for e.g. gameplay the gameplay TileMapLayer should not have a matching bit on the collision layer with the NavigationPolygon parse collision mask, else it will be treated as duplicates with errors and rejected cell data.