Preventing a NavMesh to walk on paths that are too narrow


I was playing around with the Unity’s navigation system as I am about to write a new AI, and this is what I’ve noticed: the NavMesh agent is wider than it’s path, and yet it walks on it. I have some places in the game which are meant to be inaccessible to some AI (for example, if I had an oversized monkey and a midget cow in the game, I’d only want the midget cow to walk through).

Excuse my terrible job at making a screenshot, but basically, this is my problem (the green circle is the NavMeshAgent and the blue path is the navigation mesh):


I hope I have explained the question well. Is there a built-in way of checking if the path is too narrow, so that I could stop it from passing on?

Thanks in advance!

EDIT: After posting the question I have noticed that it is not clearly visible in the screenshot; the AI is coming from the bottom to the top, viewing from the screenshot perspective perspective (basically, after it walked across the narrow area).

If you have Pro, you could use Navmesh Layers – for example, one for big agents and another for small agents that can slip through thinner areas.

If you don’t have Pro, perhaps you could use a NavMesh Obstacle to close off the pinch point for big agents, or monitor for when an agent get stuck in a pinch point and steer around it.