- Home /
How to prevent flying enemies from clumping together?
I'm making an arcade flying simulator, and I have encountered a problem with the enemies that chase you. They all clump together behind you. This happens because all of them are trying to be directly behind you. How would I make it so enemies don't crash into each other, but stay at a safe distance away from one another while still trying to catch the player? I thought about using sphere colliders that would cause a certain velocity to be applied to an enemy if it breached another enemy's space, but that would look completely unnatural. I basically need to find a way to rotate the enemies when they get too close to each other so that they point in a parallel direction relative to each other and don't clump. Help?
this question has many answers and is kind of open ended. first of all when enemys begin following your player you should be organized enough to have references of the attackers in a list or array or know how many are following. if you simply want enemys in a side by side line behind the player, you could put an empty child object behind the player as a position marker and enemys could simply use the the marker's transform.right and negative transform right multipled by the number of enemys to find there position.
Answer by Zaeran · Apr 11, 2019 at 07:01 AM
You want to look at Flocking AI. Boids is a good starting point.
Your answer
Follow this Question
Related Questions
Kill character on impact 1 Answer
Why do the AI get caught on trees? 0 Answers
NavMeshAgent does not follow player 0 Answers