A* Pathfinding Project

Considering AI collider size


#1

Hello every one.

I think this is a very basic for path-finding but I’m not sure if I don’t understand how this library should work or it’s a matter of configurations

I’m making a 2d game with normal space, not tile based, and I have players and monsters with a variety of sizes and shapes. I’m generating a normal grid graph, the navigation is working just fine.

But not only big sized entities are considering paths where they can’t fit in, my AIs are getting stuck on walls edges very often, they think they can move from this path but their collier is larger than the cells in the grid graph.

how are we supposed to deal with different sizes? is there a way to adjust the cell size in the grid graph ? and I don’t supposed we have to create a graph for each entity navigating ?


#2

Hi

Usually what people do if they have many units with different sizes is that they create a small number of size categoeries (e.g. 2 or 3) and then have a graph for each category.
Take a look at this page for more info: https://arongranberg.com/astar/docs/multipleagenttypes.html


#3

Thanks aron.
so in my case the cell size should roughly match the agent size?
I checked the link you provided, it referenced something called character radius, but I can’t find it in my inspector, is it a pro feature ?


#4

The page uses a recast graph which is a graph type only available in the pro version, but the principle works exactly the same for grid graphs.

You’d probably adjust both the node size and the collision diameter setting (and possibly the erosion setting) for each graph.