A* pathfinding 2D -> how to force agents not to navigate too close to walls? (with examples)

Hi,

For sake of simplicity:
I’ve generated 2D grid with walls and floors, Grid graph is generated and navigation is working fine, but there are I would like improve path finding to avoid situations like this:
image
As you can see, agent going to close the wall, I would like that “preferred” path was 1 tile away from the wall?

Can someone suggest how this can be achieved with procedural generated map?
Should I look deeper in to the GraphUpdateScene and try to generate shapes that will match walls with + 1 tiles on the bounds?

As you understand I’m a bit confused with right approach of doing this, and will appreciate any suggestions/guides, thanks.

Hi

If you want to disallow moving close to walls completely, then adjust either the grid graph → collision testing → diameter setting or the erosion iterations setting.

If you just want to bias the pathfinding, then you can use the ‘erosion uses tags’ option. See GridGraph - A* Pathfinding Project and Working with tags - A* Pathfinding Project

Thanks for quick response, appreciate hard work you doing here :}