Solutions for NPCs to not collide with each other

Hi there. I am trying to find a solution for my zombies so that when they chase you, they don’t form a line and try not to collide with each other. I’m sure you’ve seen it in game somewhere and they look pretty abysmal and unrealistic, which is why I’m trying to find a solution for this.

Things I have tried:

  • flocking simulation; needed was separation part of it
    • didn’t work because you can’t manipulate the NPC (by that I mean change its velocity so that it avoids the nearby NPCs) when the :MoveTo() method is used.
  • hitboxes
    • using a grouping class where it knows all of the zombies in the group for more efficiency.

Please leave any other strategies that I may use so that my NPCs don’t collide with each other.

EDIT: What I mean by not colliding is this:

image

It doesn’t matter if they collide sometimes, but I wanted them to try their best to steer away from the others in their group.

You could maybe do a Magnitude check if a Zombie is near another Zombie?

yeah but as i said, i can’t change anything while the zombie is moving, even when i do a magnitude check.

just like that, i think i solved my problem (stop the zombie from moving, then make changes) . thanks for your reply.