A* Pathfinding Project

Add small margin - disable walking on borders


It’s self-explanatory from the images: I don’t want it walking around the borders/edges of obstacle.
Erosion does not help and increasing the node size is out of the question.

I intend to use this at runtime (my goal is to create this limitation after I add an object to the map).
I’m using free version (just waiting for some sale to buy it).
It’s for a RTS grid-based game, and I don’t want to fully disable diagonal.


Hey sorry for the late reply.

I assume the reason you’re using the graph with node sizes this big is for easy grid implementation for game. Though this limits the amount of data the agents can use to navigate around.

You can easily add a graph just for movement navigation (smaller node size), and a graph for finding grid cells your agents can navigate to (large node size)

Then in your destination setter make it so it only uses the large node graph, while agents can only walk on the small node graph ( can be set in the seeker)


After I redo the steps it worked, and I think my problem was with the Start End Modifier.

But your tip is really good, I will consider it, thanks.



I think I’m facing the same problem, in the picture the green line represents the path of a ship.
Obviously the ship should try to go through the center of the obstacle gap but I can’t find the way of achieve it.

Here is my ShipAI config:



It looks like your smoothing modifier is set to a very high value.
Generally the grid graph surface should be all points such that the center of the agent is allowed to be there. You can adjust the Grid Graph -> collision testing -> diameter or erosion settings.

You can use the “erosion uses tags” setting to make the agent prioritize moving further away from obstacles if possible. See https://arongranberg.com/astar/docs/gridgraph.html#erosionUseTags


As always, thanks a lot for your help.
I was able to improve it a little bit with your advices:
02 15

I did this adjusting the node size, making it smaller from 3.2 to 2, and making bigger the collision capsule diameter.
The path indeed seems like the agent will cross the bridge well, but id like the agent to cross the bridge straight, not curving, since the agent its a long cargo ship and It will collide with the sides. What could I do to improve that?

Also this is the cargo, now it navigates further from the shore, I used erosion as you mentioned, but I still dont understand why it has to go that way, I used erosion with tags but it doesn’t seem to change when set more than 2.

This is how I would like it:

These are my grid settings:



You also have to set penalties on the Seeker component to increase the cost of the ship from moving close to the shore.


When erosion uses tags is used then the nodes closest to the shore will get the “First Tag” tag (Shore in your case). The ones one node away from the shore will get the next tag, and so on for a maximum of [Erosion iterations] tags.