Objects 'Clumping' problem

Hi,

I have a scenario where there are about 50 to 100 objects all following one target. All objects have rigid-bodies, non-trigger colliders, and using physics based movement.

After chasing their target for a while they end up being very close to each other and start to clump. As a result they all start bumping into each other. This starts to slow the game down, so I am guessing it’s down to all the excess physics interaction going on between them.

So, I am looking for suggestions on the best route to avoid them ‘clumping’ together. Is there a traditional method dealing with this type of scenario etc?

Thanks!

Paul

This is a super-difficiult and super-cool problem.

Here’s one quick solution that can sometimes help.

Your target is TT right.

Make an imaginary sphere around TT. Well … imagine it :slight_smile:

Take a number NN and a radius RR. You will tune these values later. At first try say “20” and “15 meters”.

For NN times, make a new marker (I mean empty game object) called TT1, TT2 etc.

In fact position those randomly within a sphere of radius RR around TT.

Using gizmo or something add a dot for all these for your benefit. Note that as the spaceship at TT actually moves through space, all these “secondary targets” will follow - right? As the spaceship pitches, rolls and yaws this “cloud” of TTn will sort of swing around in space. OK?

Now regarding your 50-100 chasers.

In fact, don’t make them chase TT. Make each one of them randomly choose one of the TTn, and chase that.

Again, test this over and over with different values of NN and RR. And instead of “a sphere” the random TTn points could be on (say) a halfsphere facing forward, or on a small plane normal to the forward of the TT-spaceship.

Further, you may want to randomly change the TTn (“every four seconds” or something) which each chaser is looking at, and further you may change to TT itself when within a certain distance, perhaps. (Naturally this depends entirely on what you’re doing and why.)

I hope this approach helps. It is vastly easier if you post a screen shot to give an idea of the scales involved, etc.