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:
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.