PathUtilities.IsPathPossible to take into account the collider size

I have a little method that checks if there is enemies around, then it has some checks on priority, distance and if path is possible, before setting the destination, the problem that I have is that PathUtilities.IsPathPossible returns true if there is any small gap, totally ignoring the size of the gameobject, so it may say that a very small gap between two walls is possible and it will try to cross that gap getting totally stuck because the actual object is 10 times bigger, different enemies also have different sizes, so one may be able to fit, while other doesn’t.

I’m sure there is an easy fix for that but I couldn’t find a working solution for this after a day of playing around, any suggestions?

Hi

Generally graphs should take into account the radii of the enemies. So for example on recast graphs, the ‘character diameter’ field should be raised so that the navmesh represents all possible positions for the center of the characters.

If you have multiple enemies with significantly different radii, you may want to use different graphs for them. See Multiple agent types - A* Pathfinding Project

totally missed that you could have 2 of those, thanks!

1 Like