Astar path script scan isn't detecting my collisions correctly


Everyone so for I love this plugin if that is the correct term :). I have a bit of an issue with it and don’t know if this is the correct section to post this. Hopefully it’s alright :slight_smile:

I have a grid map setup for my game and the player is able to create roads. The roads have 2 Tilemaps. One is for colision of the road which in my case is always dirt and the road sprite which is walkable.

Here is the scan I get from the Astar Path. I have outlined with purple where are my colliders of the road which aren’t being detected.

Thanks for all the help :slight_smile:


Are the colliders included in the collision testing layer mask in the grid graph settings?

1 Like


Yep I included them.

Are you sure they are marked as colliders and not triggers?

Yes they are exactly the same as my dirt tilemap.

Do you think you could post a screenshot of your graph settings and the objects?

Sure :slight_smile:

Here is a picture of my graph :
Enemy :
Road tilemap :


The ‘Diameter’ for the collision setting is set to 0.3. That means it will only check in a small circle in the middle of the node for colliders (the width of the circle will be 30% of the node width). Set it to something closer to 1 for better results.
In the current beta there is a visualization of this value which helps to avoid these kinds of issues.

I’ve tried that but then the whole tile becomes unavailable.

It does look like your corridor is much more narrow than a single node.
You cannot have it both ways. In this case you want to avoid making the node unwalkable due to a narrow corridor, but in the other case you want to detect colliders near the edges of the node.
You can increase the resolution of the graph to be able to differentiate between finer features.

I am not sure i understand what you mean. Could you explain please?

In your last screenshot you show that the hole that was dug is pretty narrow. So the collider definitely overlaps the node. So it is reasonable that you’d want a smaller diameter for your collision testing.

However earlier you showed the colliders that you do want to detect. They are definitely further away from the center of the node than the edges of the hole in your last screenshot. So it’s hard to set the diameter to any value which works for both.

Oh ok I understand. I’ve even tried creating two different grid graphs and check the collision for both but seperated. Did not work. Do you maybe have any suggestions on how I could achieve this or if there is any tutorial on it?

Thanks for all the help so far ! I really appreciate you taking the time :slight_smile:


Well, your constraints are very inconsistent.
It is possible to do it with multiple graphs and some code, but I don’t see why you have to handle the different colliders that differently.

Am I correct in interpreting that you want the nodes touched by the purple colliders (here: to be made unwalkable?

Hmm not sure how I would be able to do it with multiple graphs and code… :confused:

What is inside the purple is the collider which shouldn’t be passable. So no it isn’t ment to be walkable.

But the purple collider only covers a very small part of the node?

Yep example :

Top one is the walkable part and the bottom one isn’t walkable.

I’d suggest that you put a collider there that covers the whole node in that case.

Then the player won’t be able to walk on the road.

But you just told me you wanted it to be unwalkable…