• 2D
  • Stacking TileMaps for Navigation2D, Zombie walks through walls

I've made a TileMap scene that is a simple house, and I instanced that on top of a Ground tilemap which is an endless field of walkable grass tiles.

The scenes are arranged as so:

Navigation2D
- TileMap(ground)
- TileMap(House1)
- TileMap(House2)

I created a path using get_simple_path to move a Zombie character from inside a house to a point outside and it walked straight through a wall.

It took me a while but I've realised that while my player-controlled Kinematic2D character gets blocked by the walls as expected, the Navigation2D path totally ignores the instanced houses and only cares about the ground TileMap, presumably because it's the first one under the Navigation2D node? If I draw walls on the ground TileMap the path goes around them as expected.

Is there a way to have the Navigation2D behave the way I expect, or should I just draw everything in the one TileMap?

Thanks for any help you can give!

Godot version 3.2.3.stable

Hi,

Navigation in Godot is working pretty simple. It doesn't take into account anything like overlapping/blocking objects etc. If you have tilemap full of tiles that allow walking navigation will simply allow walking everywhere. If you don't want that behaviour you need at least remove tiles from ground tilemap if another tile is set in any other "blocking" tilemap, but if you can do that then of course you can also use the same tilemap for ground and houses.

@terrarum said: It took me a while but I've realised that while my player-controlled Kinematic2D character gets blocked by the walls as expected, the Navigation2D path totally ignores the instanced houses and only cares about the ground TileMap, presumably because it's the first one under the Navigation2D node?

I am not sure, but I think navigation just takes all child navigation meshes/polygons as space you can move and calculate path. It works more like summing them up. If your first tilemap allow walking everywhere navigation will always allow moving anywhere.

I was afraid that was going to be the answer! Fair enough, I guess I'll just draw everything on the one TileMap. Thank you!