How do I stop Humanoids from climbing onto Eachother's heads?

I want to be able to have these NPCs charge into battle, and not start stepping onto eachother’s heads with these weird physics.

The Humanoids I will show below, keep climbing onto eachother’s heads regardless of Gravity, pathfinding distance, etc.

As you can see in the coding image, they only move to 3 studs away from the enemy’s humanoid root part. So once they get in range, they don’t keep pushing against the enemy. (They may end up pushing against allies however.)

I have also tried increasing the gravity to 900, which sort of helps in making them “Fall” off of each other’s heads, but sometimes players and NPCs can just walk onto the heads of a shield wall formation, and go right over it.

I have already set the Climbing SetStateEnabled to false as shown in this image here:
2

Even though climbing was turned off, they still climb onto eachother’s heads.
The 900 gravity seems more like a temporary fix, because if the players or NPCs somehow fall down with that much gravity, it sends them flying, and my anti-exploit sometimes thinks their speed hacking as well.

Here is a short video of the problem in action, with 192.6 gravity instead of 900.
(I want to achive 192.6 gravity without this problem.)

For extra details:
I do not use bodyvelocity or anything to push the humanoids around when they are attacking, moving, etc. Just simple moveto pathfinding.
When they attack, they use the raycast melee hitbox made by swordfin.

CollectionService:GetInstanceAddedSignal("Zombie"):Connect(function()
	for _,zombie in pairs(zombies) do
		zombie.human:SetStateEnabled(Enum.HumanoidStateType.Climbing, false)
		zombie.human:SetStateEnabled(Enum.HumanoidStateType.FallingDown, true)
		zombie.human:SetStateEnabled(Enum.HumanoidStateType.Flying, false)
		zombie.human:SetStateEnabled(Enum.HumanoidStateType.Freefall, false)
		zombie.human:SetStateEnabled(Enum.HumanoidStateType.Swimming, false)
		zombie.human:SetStateEnabled(Enum.HumanoidStateType.Ragdoll, false)
		zombie.human:SetStateEnabled(Enum.HumanoidStateType.StrafingNoPhysics, false)
		--?
		zombie.human:SetStateEnabled(Enum.HumanoidStateType.PlatformStanding, false)
		zombie.human:SetStateEnabled(Enum.HumanoidStateType.Landed, false)
		zombie.human:SetStateEnabled(Enum.HumanoidStateType.Jumping, false) --?
		--Enabled.
		zombie.human:SetStateEnabled(Enum.HumanoidStateType.Dead, true)
		zombie.human:SetStateEnabled(Enum.HumanoidStateType.Running, true)
		zombie.human:SetStateEnabled(Enum.HumanoidStateType.RunningNoPhysics, true)
		zombie.canpath = true
		swordcheck(zombie)
		makebulletcache(zombie)
	end
end)
function pathToTarget(zombie)
	if zombie.target ~= nil then
		local path = game:GetService("PathfindingService"):CreatePath()
		path:ComputeAsync(zombie.root.Position,zombie.target.Position)
		local waypoints = path:GetWaypoints()
		local currentTarget = zombie.target
		for i,v in pairs(waypoints) do
			if v.Action == Enum.PathWaypointAction.Jump then
				zombie.human.Jump = true
			elseif zombie.target ~= nil then
				zombie.human:MoveTo(zombie.target.Position - CFrame.new(zombie.root.Position, zombie.target.Position).LookVector * 3)
				if not zombie.target then
					break
				elseif checkDist(currentTarget,waypoints[#waypoints]) > 10 or currentTarget ~= zombie.target then
					pathToTarget(zombie)
					break
				end
			else
				pathToTarget(zombie)
			end
		end
	end
end

Please provide me with solutions to this problem!
Be it a coding solution, or a different kind of solution like editing something in the humanoid’s parts.

I have already tried changing the density of their HumanoidRootParts.
I have also turned off collision among allied units before and it doesn’t solve the problem since they still climb onto the heads of their enemies.
(Due to pathfinding to the Player Character who made it over from pushing, and is on the other side.)
It also doesn’t look good since they don’t spread out and just jumble into a small ball of bodies.
I have also set their MaxSlopeAngle to 25 and it didn’t help either.
(I need them to be able to climb slopes like ramps.)
Making Allies and Enemies non-collide would mean enemies could just waltz right through shield walls.

Here are some forum posts I have seen beforehand:

I was unable to find anything else related to this “Head Climbing” Issue.

1 Like

You could use the PhysicsService to set all mobs to not be able to collide with each other. Only downside is they could all occupy the same space inside each other but at least they wont be jumping on their heads.

More info: https://developer.roblox.com/en-us/articles/Collision-Filtering

1 Like

Sadly, I have already tried using physics service to make them all uncollidable with eachother already.
As stated above. (This was something found in the other Forum Posts mentioned as well.)
In fact, I made it so Units in shieldwall formation would not collide with their allies.
But enemies needed to collide so they couldn’t just run through it. They ended up going over it though, via head climbing.
With all NPCs being uncollidable, they just formed a giant meatball of arms and legs…
I would like to know of a solution without using PhysicsService, or any of the other stuff I already tried above that didn’t work for what I am seeking.
Thank you for trying to help, though!

Have you tried setting the “Friction” property of the head to 0?

image

1 Like

You can disable Humanoid states. I’m not sure that solves the physics of climbing. Is it possible that you have enough partial collisions in the model that the engine recognizes them as ladders?

Only way i know how to test that is replacing all collision with a single block too big to jump on.

The humanoids aren’t really cimbing, they’re going over. It’s just how humanoid physics works, they go over or jump over things if they are moving fast enough. This isn’t the case for normal part physics using body-movers and constraints (humanoid physics uses different physics).

Im trying to find a solution, and if I find one i’ll update you. (Sadly, the post you linked of mine I just disabled collisions between humanoids and made my own collision system for humanoids using rectangular prisms for hitboxes. Didn’t find one for using default humanoids)

What if the mobs were uncollide with eachother using PhysicsService like I suggested BUT you leave out the HumanoidRootPart? Because you can specify which parts get added to the collision group.

If only the HumanoidRootPart was colliding, this should hopefully make it so they dont merge into a giant ball but also not provide the reason to jump on the head. If they still do, you could increase the height of the HRP maybe. Just a thought.

2 Likes