Get NavMeshAgents (Enemies) to not bunch up together


As you can see from the image attached, a lot of skeletons (selected) are attempting to get close to the player (the grey thing in front). However the ones in the back just want to move forward, and don’t consider other skeletons to be blocking their path. So the result is a huge mob of enemies only in one direction.

Is there a method of getting the skeletons to move around and encircle the player, similar to other games like starcraft, where a huge mob will find it’s ideal spot and if blocked by other enemies, move around instead of just forward?

  1. Check the Nav Mesh…
  2. Maybe you shoud disable the collision for enemy to enemy to test Change the Layer Physics.
  3. You have probably set the stoppingDistance to high.
  4. Assign an obstacle thing for agents… to your player.

Just play around and see what could be the problem.

I might make a bunch of empty objects to use as attack position markers. Then attach them to the player so they move with the player. Then have the agents target the attack markers. Make a script for the markers with a claimed bool. When an attacker goes to that marker, set it as claimed. Then make others search for an unclaimed pos. Be sure to clear claimed when they die. Make as many markers as you need. And maybe add a little random offset if it looks too regular.

Ive heard of a technique where you can enable a navmesh obstacle on the enemies when they start attacking. This will cause other enemies to path around them. There is a lot of work figuring out when exactly to enable/disable