- Home /
Get NavMeshAgents (Enemies) to not bunch up together
Hello!
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?
Answer by Lost_C4 · Feb 28, 2014 at 10:24 PM
Check the Nav Mesh...
Maybe you shoud disable the collision for enemy to enemy to test Change the Layer Physics.
You have probably set the stoppingDistance to high.
Assign an obstacle thing for agents... to your player.
Just play around and see what could be the problem.
Answer by mossman3333 · Jun 22, 2014 at 06:39 PM
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.
Answer by scplayer1 · Apr 12, 2016 at 09:58 AM
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