#2D navmesh baking only works for first layer of tilemap?

7 messages · Page 1 of 1 (latest)

floral mantle
#

I have a 2D navigation region with default settings and a simple navigation polygon.
As a child it has a tilemap that contains 2 layers.
These layers contain a tile that has a physics layer painted.

When I paint some of these tiles on both layers and then bake my navigationpolygon. The navigationpolygon only seems to take into account the physics of the first tile layer.

Why??

queen oyster
#

Because TileMap does absolutely nothing to prevent users from spending a lot of time creating completely invalid layouts with the TileMapLayer system. It even encourages users to create invalid layouts by stacking polygons with the TileMapLayers system. You can not overlap and stack navigation meshes, that will corrupt the navigation map, and if you stack collision shapes it will randomly cause flipped polygons due to how poly path calculations work.

floral mantle
#

Hey thanks for the reply and the PR smix! This will make it harder for me to move from own solution with clipper to the 4.2 solution, maybe I'll wait it out a bit...

#

Wouldn't it be possible to union all the polygons from all the layers before creating/baking the nav mesh? I believe you're using clipper in the background anyway, right?

queen oyster
#

The reason why the traversable outlines and obstruction outlines are not merged in between but only at the very last step is performance, limitations of the used fill rule, and to avoid bugs with poly holes. If you have your own solution you control the input, but in the wild users are manics when it comes to their layouts.

#

same reason why we do not support float positions and went with integer only. What enables 1 specific project curses 10 others when it comes to bugs and performance. TileMap users are not a homogeneous group, they all have their own idea how things should work which is also one of the reasons why TileMap has for years not solved all its internal polygon issues with collision polygons, occlusion, or navigation.