Download

How to froce AI to keep distance between each other?

Hello, everybody! I’ve got a very simple AI wich is just run towards the player until he reaches him. But the problem is that if it is too much of them they start to run in one line wich is not very interesting. I’ve tried to solve this problem with use RVO Avoidance set to try in chatacter movement component. But this looking not very great and Actors start to fly on the ground in every directions. So may be there is a solution with EQS, but I don’t get it. Or maybe there is some kind of node wich do magic and keep distance beetwen AI actors.

The problem is that the navigation system will take the shortest / most efficient / stupid magical whatever route it choses to get to you, and that will obviously be the same route.

So if you want them to “spread out” then you have to tell them to change direction before they move to you. Like chose a random direction vector in front, move there for 2 meters, then move towards players.

You can also check if another AI pawn is in front (with a collision mesh or a linetrace) and that will trigger the random direction change.

That is really the simplest way I can think of it. If you want something more fancy and good looking, then you have to program a specific behaviour (in your bp or your behaviour tree) that tells the AI to “go around each other” before they move towards you.

I had the same issue and I had a little bit of success using a box collision to assign a random point in the bounding box around the player as the new goal value, however, they still bunched up a lot. This tutorial is a much better solution: https://www.youtube.com/watch?v=iYcDyJUByJg