Keep Enemies from moving on top of each other? (Like on shoulders)

Hello! I’m having an issue where enemies end up walking on top of each other, as the screenshot shows, like world war z22818-worldwarz.jpg. any idea how to keep this from happening? Thanks!

When I had this problem, rigid body mobs climbing each other, it was because I wanted them to be able go up stairs, climb rocks … . But they couldn’t tell stationary friends, and climbed them as if they were rocks. Was able to fix it with little things:

Don’t let the AI grind into another goblin. It you get a collision with another goblin, stop moving for 0.5 second, or shift to diagonal (to try to walk around,) or tell the other goblin to get a move on … .

Make sure gravity is high enough. If you need to, code-increase the goblins’ gravity (velocity.y+=1 … .) High enough, it will counter the upward force of grinding, or give enough force they slip off the top of a friend’s capsule.

Code-force them to land. Occasionally (if they’ve recently hit another, every 5 frames… ?) check height above the ground and/or y-velocity – whatever can identify “friend climbing.” If they are too far up for no reason (they didn’t just jump or fall) slam them down. Or, OnCollisionEnter with a goblin can do this. This is kind of a brute-force backstop method, for the 1% the other’s don’t work.

I there, before try programming, you should first try to make changes to the “Character Controller”.

Try to decrease here the Slope Limit". This defines how high climbing is usually allowed for the character.

Most times a find a value, that allows to climb on stairs but not on larger creatures.

If this not works allone try to make the capsule collider larger or add an box collider.

Only if really high stairs and small creatures needed you need to play around with raycast programming.

ok, first world war Z is an awesome movie… so why this is bad? :slight_smile:

for your problem, there are several options: you can set there colliders not to collide with each others by setting the collision matrix.

or you can lock your enemies Y axis.

Hey @sfbaystudios - What did you end up doing to prevent this? I never had this problem before, but while fixing a variety of NavAI and Rigidbody issues, now it happens all the time - in my case my player ends up on top of mobs all the time. I’ve made sure gravity was set, gave the mob mass, froze my Y constraint on the player rigidbody. For some reason any contact pushes the player on top of the mob. Driving me NUTS!