godot
godot copied to clipboard
`NavigationRegion2D` only respects the first layer of a tilemap when baking source geometry
Tested versions
Reproducible in 4.2.stable
System information
Godot v4.2.stable - Pop!_OS 22.04 LTS - X11 - Vulkan (Forward+) - integrated Intel(R) Graphics (ADL GT2) () - 12th Gen Intel(R) Core(TM) i7-1260P (16 Threads)
Issue description
When baking a navigation polygon mesh, a NavigationRegion2D
should scan its children recursively (or nodes of a group depending on the source_geometry_mode
) for collision shapes and bake the mesh around them. This should also work for collision shapes that are a part of tiles in tilemaps.
It does work if the tilemap only has one layer, but if it has multiple, only the first layer is respected.
In the above image, the lower left square should also be drawn around when the navigation polygon is baked, but it is not because it is on layer 1 of the tilemap.
Note this does not work for any of the source geometry modes.
Steps to reproduce
- Create a new 2D scene
- Add a
NavigationRegion2D
- Add a
TileMap
node as a child of the NavigationRegion - Set up the tilemap and tileset:
- Create new tileset
- Add a physics layer to the tileset
- Add a layer to the tilemap
- Drag and drop the godot icon from the FileSystem to create a new atlas for the tileset. Create a single tile and paint a collision shape on it.
- Now go to the tilemap pane, add some tiles on layer 0 and some on layer 1
- Click on the NavigationRegion2D Node.
- Click "New NavigationPolygon"
- Draw a region around the tiles you placed
- Click "Bake NavigationPolygon"
Minimal reproduction project (MRP)
N/A (wouldn't let me upload sorry)