Hello!
I am sure I am missing something obvious here and that this question has likely been addressed. But I just need some help tweaking my Grid Graph.
The issue here is that because the wall tiles have a Sprite collider type on them (the collider is 1x1 units), any nodes next to one of these wall tiles with colliders are considered unwalkable as well.
I’m guessing this is due to the edge of the node collider overlapping the edge of the wall collider, but when I reduce the Diameter on the Circle collider from 1 down, it leads to inconsistent results or just no collisions at all.
Any advice would be helpful.
Hi
If your sprite colliders take up exactly 1 tile they may get detected as an obstacle in the neighbouring node due to floating point errors. Setting Grid Graph → Collision Testing → Diameter to something like 0.95 should make it more predictable in this case.
Hi aron_granberg, thanks for taking a look!
I’ve tried fiddling with the Diameter based on your suggestion and if anything, the results appear to be more unpredictable.
The TilemapCollider2D for the walls in this image is using a CompositeCollider2D with the Outlines Geometry Type. I tried replacing that with a Polygon Geometry Type and a non-composite collider with no luck.
Diameter 1:
Diameter 0.98:
Diameter 0.95
I know that I can go and manually change the colliders for the “edge” wall tiles to be inset by a pixel or something, but this seems like a fairly common use case, so I’m just wondering if there’s anything else within the astar project I can try before adding that requirement for the art.
Thanks for all the help!
Hi
You should always use the Polygon type, as mentioned here: Pathfinding on tilemaps - A* Pathfinding Project
What version of the package are you using? It looks like you are using a pretty old version?