Pathfinding creating waypoints in blocked paths

I’m using PathFindingService in my game to make a npc walk to items but the problem im having is waypoints are being created in places that should be blocked. I used navigation mesh to make sure and its blocked and im not sure if im reading it correctly but it looks blocked according to it. There is no passthrough on this part and the part is can collide on

local module = {}

local Pathfinding = game:GetService("PathfindingService")
local debris = game:GetService('Debris')

function module.NewPath(pos, pos1)
	local path = Pathfinding:CreatePath({
		AgentRadius = 1,
		AgentHeight = 2,
		AgentCanJump = false,
		WaypointSpacing = 4
	})
	local success, no = pcall(function()
		path:ComputeAsync(pos, pos1)
	end)
	if success and path.Status == Enum.PathStatus.Success then
		local waypoints = path:GetWaypoints()
		
		for i,v in waypoints do
			local t = Instance.new('Part', workspace)
			t.Anchored = true
			t.Position = v.Position
			t.Size = Vector3.new(1,1,1)
			t.Color = Color3.new(0,0,0)
			t.Material = Enum.Material.Neon
			debris:AddItem(t, 10)
		end
		
		return  waypoints
	end
end




return module

1 Like

Was able to find out the problem.
In case anyone is wondering the problem was the spawner part which spawn’s items had a PathfindingModifer with passthrough on which apparently makes pathfinding think it can go through the other parts if that makes sense

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.