Tiles next to colliders also marked as not a node

Hi,

I’m having an issue with using the A* Pathfinding Project Pro, version 3.7.

I have tiles that are .16 units big. A*'s nodes, likewise, are .16 units big, to match. This is a 2D game, so I rotated A* along the X axis -90 degrees. For viewing purposes, in Debug, I set the unwalkable size to .1.

The nodes are set to the middle of the tile… yet it is still not working. A picture is worth a thousand words, so here is how it looks:

The sections highlighted in green are my 2D Toolkit edge colliders. As you can see, the fences are correctly not marked as nodes. However, the nodes adjacent to the fences are incorrectly also marked as not walkable nodes. As a result my companion cannot follow me between these two fences. The only way I have found to get nodes to show is to decrease the node size, but that causes other problems and I think having the node size the same size as the tiles is best.

My settings.

Solved it. For those wanting some advice on getting AStar Pathfinding Project to work happily with 2D Toolkit’s TIleMap, here are the steps to reproduce the image seen below:

  • Make sure both A* and 2D Toolkit are in 2D mode
  • Lowered the diameter of the sphere used in A* to .8 (when it was set to 1 it would collide with adjacent tiles’ colliders).
  • Use the Sphere collider
  • You will notice that if you scan now, almost everything is walkable. This is because of the edge colliders. Edge colliders are just line segments, they have no concept of “inside” or “outside”. Since the .8 sphere casted does not hit it, A* thinks it is walkable. To fix this, convert all edge colliders to polygon colliders. There are many examples of how to do this. I took this one and turned it onto a menu item. https://github.com/HawkenKing/Edge-collider2D-to-Polygon-collider-2D/blob/master/EC2PC.cs

And with that, I got this:

Perfection.

I also turned off “cut corners” so the follower wouldn’t run into a collider.

1 Like

Great that you managed to solve it.