Distance between enemies

Hi there, I would like to know which method could do to keep some distance between enemies. i have a simple AI to go and attack the player, and work fine, but enemies pile up each other … have any idea?

hi, you can use two methods, (at least two i know), through raycast and trigger.

the second one is easier i think, because you simply add a trigger to your player… may be someone more has a better option ?..
greetings!

Thx dude. now suppose i use a trigger, dont know how to keep the distance between triggers while advance to the player ?

Is simple

Distance between enemies not player, the idea is that enemies don’t pile up one above the other, i wanna keep distance between enemies

I think it is a bit more involved than just getting the distance. I think you want angle. So get the angle between each person around the enemy, find the nearest open spot and go to it. You may even need to plot a course around the target which is even more fun.

So say that enemy X has a target distance of 3 units and an angle of 30 degrees. You would have to find all the angles -180 to 180 and find an open spot 60 degrees wide (30 on each side) and then go park your enemy within that space. You could be nice and force a snap in that angle too, so the next guy could find a spot and get in easily.

what you say makes sense, but I’m new in unity and i don’t know how to pass it to code