Moving agent avoid other moving agent

I use nav mesh agent and my zombie try to reach the player position but instead of try to get around they gang bang with other zombie in front of them, how to improve that ? Like get around for take the other side or just don’t move if they cant reach the player position because other zombie are in circle around the player.
Also my zombie moving my Player, do you know how i can fixe that ?
My Player use CharacterController.
My Zombie use Nav Mesh Agent, Rigidbody and Capsule Collider.
nhfu4e

private void Chase()
{
if (!_navMeshAgent.pathPending)
{
if (NavMesh.SamplePosition(_targetDetection.Target.transform.position, out NavMeshHit hit, 20f, _navMeshAgent.areaMask))
{
_navMeshAgent.SetDestination(hit.position);
}
}
}

You have to mark agents as a obstacle, and make a runtime bake, but its hard to do. If you are going to try u can use GitHub - Unity-Technologies/NavMeshComponents: High Level API Components for Runtime NavMesh Building.

But before that in my opinion;
Try to decrease diameter of agents and their capsule colliders, maybe you get better results without it.

Might I recommend using a surround algorithm such as this:

1 Like