Hello developers,
I have an issue. The Zombies i made that work perfectly except they walk into eachother and not around eachother which i wanted to fix.
I tried working with pathfindingmodifiers, they work only the zombie walks around its own hitbox. Which i don’t want. I tried all kinds of stuff that did not work. Like having every zombie have a different costs label and changing the costs that did not really work out as i wanted because, costs dont get updated whenever a new zombie gets added or removed. Which makes the zombie not walk around the more recently spawned zombies.
This is a small part of my spawn function. For the pathfinding i use simplepath which is a community module.
function Zombie.new(name: string)
local Model: Model = ZombieConfigurations.Model:Clone()
Model:PivotTo(GetRandomSpawnCFrame())
Model.Parent = Zombie.SpawnFolder
local Hitbox = Model:FindFirstChild("Hitbox")
assert(Hitbox, "No hitbox detected please check zombie model [" .. name .. "]")
local Modifier = Instance.new("PathfindingModifier")
Modifier.Label = HitboxLabel
Model.Parent = Hitbox
local self = setmetatable({}, Zombie)
self.Model = Model
self.RootPart = Model:WaitForChild("HumanoidRootPart")
self.Humanoid = Model:WaitForChild("Humanoid")
self.Animator = self.Humanoid:WaitForChild("Animator")
self.Humanoid.WalkSpeed = GetWalkspeed(ZombieConfigurations)
self.Path = SimplePath.new(Model, {
["AgentRadius"] = 1.5,
["AgentHeight"] = 5,
["AgentCanJump"] = false,
["AgentCanClimb"] = false,
})
self.Path.Visualize = debugMode
table.insert(AllZombies, self)
self:Init()
return self
end
This is a video of the problem to better explain it.
robloxapp-20231208-1826107.wmv (1.6 MB)
I don’t know if there is a good solution for this or if anyone else had this problem before. Anyways, if you got any idea please let me know!