# Navmesh - How to calculate path AROUND NavmeshAgent Obstacle Radius?

I might be missing the obvious since this seems a bit strange of a behavior.

Let’s say we have 2 agents, Agent A and Agent B, and both have a Obstacle Avoidance radius of 0.5.

Agent B is currently static, and Agent A wants to move towards the TargetPos as illustrated below (blue is the navmesh, the red circles represent the Object Avoidance radius for each agent):

My problem is that Unity always Calculates the shortest route to the TargetPos (yellow path), and because of the Obstacle Avoidance, Agent A ends up stuck in the corner, unable to pass by Agent B.

What I would like instead, is something like the green path in the image, where the calculation takes into account Agent B Obstacle Avoidance cylinder and plans around it. Or, since I’ve realized the agent avoidance doesn’t re-calculate the path but does a local avoidance (at least according to the navmesh debug display), to take the longer route through the left side of Agent B so Agent A doesn’t get stuck in the edge.
Is there a way to do it? Is it part of Unity’s NavMesh system?

NOTE: When Agent B is not in a corner, the obstacle avoidance works, and Agent B goes around him.
It’s just in this situation, where going around means doing the LONGER distance, that he decides to go through the shortest path that he gets stuck.

NOTE2: It’s not feasible to add a NavMesh Obstacle component to Agent B since that would mean that if any other agents wants to calculate a path towards him (or he needs to calculate a path to anywhere) they would return as invalid! NavMesh Obstacle component only makes sense for non-agent objects. (Even Unity gives me a warning when I add the NavMesh Obstacle to a GameObject with a NavMeshAgent)

I’d still go for carving if the agent is static for a longer time. You need to toggle between the Agent and the Obstacle components, though, as they cannot meaningfully be active at the same time.

You could bake the navmesh at runtime and put a NavMesh Modifier on Agent B that has a high cost and is only active when Agent B is not moving.

https://docs.unity3d.com/Manual/class-NavMeshModifier.html

You could also try messing around with avoidancePredictionTime for the NavMesh