#2D Pathfinding with tilemaps in Godot 4

3 messages · Page 1 of 1 (latest)

silent sleet
#

Hi everyone! I created a simple top-down 2D RPG and I have some simple enemies which I want to be wandering around using pathfinding. I added a NavigationAgent2D to the enemy scene and by defining a big NavigationRegion2D over the map enemies can walk to the destination ssuccessfully. However, they don't take tiles with collision shapes (for example rocks or other obstacles) into consideration. I've read that defining navigation data in tilemaps is very expensive, so what would be the workflow for such a use case? Should I really define a big region then go into every object on the map and create a small region to exclude it from the navigation area?

woven estuary
#

Try to lookup obstacle avoidance. GDQuest has a video on it for the new Navigationserver in 3.5 (and should work pretty similarily in 4.0)
https://youtu.be/fS0IhyZrzts

silent sleet
#

I've looked into that, however if I'm understanding correctly that refers to avoiding moving objects with a NavigationObstacle2D node; I don't know how to apply that since I'm working with tilemap obstacles