Despite using PathfindingModifier path is still created ignoring the “danger zone”. How can I fix it? Check also post 9.
Maybe this is some kind of bug?
Costs = {
no = math.huge,
}
Despite using PathfindingModifier path is still created ignoring the “danger zone”. How can I fix it? Check also post 9.
Maybe this is some kind of bug?
Costs = {
no = math.huge,
}
It looks OK to me. The main thing being that you have CanQuery enabled on the Part and a valid PathfindingModifier. I do wonder if there is confusion with the Part & PM Label being the same.
My comparable example from Monkey Poop:
local pathParameters = {
AgentRadius = 2.5,
AgentHeight = 6,
AgentCanJump = false,
Costs = {AvoidZone = math.huge}
}
local path = PathfindingService:CreatePath(pathParameters)
It doesn’t change anything. Maybe it’s some kind of bug?
Im curious if the pathfinding is done on the Client or the Server?
Server
Can you maybe show us more of the script?
function _G.MoveTo(model: Model, endCFrame: CFrame)
local humanoid = model:FindFirstChildOfClass("Humanoid")
if not humanoid then
warn(`Humanoid in {model} not found!`)
model:PivotTo(endCFrame)
return
end
local pp = model.PrimaryPart
if not pp then
warn(`PrimaryPart in {model} not found!`)
model:PivotTo(endCFrame)
return
end
local path = PathFindingService:CreatePath({
AgentRadius = pp.Size.X,
AgentCanJump = false,
Costs = {
no = math.huge,
}
})
local succes, error = pcall(path.ComputeAsync, path, pp.Position, endCFrame.Position)
if not succes then
for i = 0, 5, 1 do
warn(`Pathfinding computeAsync ({i}/5) faield! Error message:\n{error}`)
succes, error = pcall(path.ComputeAsync, path, pp.Position, endCFrame.Position)
if succes then
break
end
end
end
if _G.Data.debug then
for _, waypoint :PathWaypoint in pairs(path:GetWaypoints()) do
local part = Instance.new("Part")
part.Shape = Enum.PartType.Ball
part.Material = Enum.Material.Neon
part.Anchored = true
part.CanCollide = false
part:PivotTo(CFrame.new(waypoint.Position))
part.Parent = _G.Ram.temp
end
end
for _, waypoint :PathWaypoint in pairs(path:GetWaypoints()) do
humanoid:MoveTo(waypoint.Position)
humanoid.MoveToFinished:Wait()
end
end
Help
When I add another part to part it is correctly marked in the navigation mesh. Only the terrain is not marked which causes such a path to be generated
Anyone know how to solve this? Does PathfindingModifier in general work with terrain?
(PathfindingModifier is called danger here, in the script I also changed it)