Hello again,
It’s been about a week and the brief answer is that I still haven’t figured it out. On the screenshot below, I just want to determine when the path to the target (player) is not possible. Here, the selected zombie, “Zombie_Male_02_CC2” is running endlessly into the obstacle while trying to reach a point next to the player, which is blocked off by the two zombies in front.
I first tried to implement a “slot” system (4 capsules around the player: front, back, left, right), but it had its flaws and bugs. For example, if the player rotates around and the zombie stands still, the initial slot would eventually be wrong as the zombie would be standing close to one of the other slots. Having the zombie turn around with the player to follow the invisible slot would look unatural. So I tried to update the slots whenever the player moved and turned, which was messy - ex. zombies moving around whenever the player did a slight turn.
I’ve looked a bit on this older thread: Local avoidance issues on Recast graphs
I haven’t tried adding penalties, as I don’t think that would solve the current issue, since the solution should be “no path” in this case.
I’ve experimented with NavMeshCut, but it seemed to introduce new bugs and lots of teleporting. While NavMeshCut did make holes in the recast navmesh, the pathfinding found “impossible” paths for the AIs: A path was always found for the zombie to the player, but the path would be extremely narrow so the agent was never able to traverse it.
There’s also the DynamicGridObstacle script, but I didn’t get it to work with the agents. Does it work with CharacterControllers?
I haven’t looked into the ITraversalProvider yet. Could this be used to solve the issue?