Support Forum

Is there a way of changing the shape or width of collision testing in 2D grid graphs?

I’m making a 2d where the enemies are slightly less than 1 tile wide and about 3 tiles tall (unity tiles, not astar node things). Since it is top down, I want the enemies to be able to walk up through 2 block wide gaps like this in the image, but since the collision testing is a circle, they won’t fit since it will only allow the enemy through 3 by 3 holes.

image

Is there a way to get around this, or change the shape of collision testing or something? Or will I have to design all my levels to have every door and gap be three wide? I feel like that would severely limit me on the kind of structures I could make.

Hi

It is only possible to use a circular collision check. I think most games of this type generally make their colliders so that they cover what would be the base of the objects, and put the pivot of the player at the player’s feet. Then you only need a circular check.

You can, if you want update the graph and do whatever collision checks you want. See Graph Updates during Runtime - A* Pathfinding Project