Pathfinding Service issues

I don’t see how this can be possible

1st test has the pathfinding service fail
2nd test has the pathfinding service run into a wall
3rd test has the pathfinding service working as I’d expect

All while I’m shrinking the gap, if I move the model somewhere else the pathfinding service doesn’t fail but still mimics the 2nd test if the dimensions are the same as the 1st test.

Green block is start position when I calculate a route, red block is the end position, blue blocks are the waypoint nodes.

Waypoint action is always walk

If it’s an issue with my code I can’t see how
Here’s what I’d consider relevant:

function CalculateNewPath(PathObject, Start: Vector3, Destination: Vector3)
	-- Creates the start End Visual part (Can collide/touch is off) the issue existed before I put these in

	return pcall(function()
		PathObject:ComputeAsync(Start, Destination)

		-- Creates the waypoint visual parts, issue existed before I put this in
	end)
end
-- Where I initialize the path object, happens once ever, I've messed around with these a lot and hasn't changed much
self.CurrentPath =
		PathfindingService:CreatePath({ AgentCanJump = true, AgentRadius = 3, WaypointSpacing = 1, AgentHeight = 5 })

Is this a known engine bug? I saw a few similar-ish reports.

The docs say very little about Known limitations

I doubt this is part of the known limitations, I assume it’s too simple of a scenario.

Here’s a place file,
PathfindingServiceBug.rbxl (59.6 KB)

Here’s all the code in the place file:

local PathfindingService = game:GetService("PathfindingService")

local PathObject = PathfindingService:CreatePath({ AgentCanJump = false, AgentRadius = 3, WaypointSpacing = 1, AgentHeight = 5 })


local function CreatePart(Position : Vector3, Size : Vector3, Color : Color3)
 	local p = Instance.new("Part")
	p.Parent = game.Workspace
	p.Color = Color
	p.Anchored = true
	p.CanCollide = false
	p.CanTouch = false
	p.Size = Size
	p.CFrame = CFrame.new(Position)
	p.Shape = "Ball"
	return p
end


function CalculateNewPath(Start: Vector3, Destination: Vector3)
	CreatePart(Start, Vector3.new(1, 1, 1), Color3.fromRGB(145, 255, 143))

	CreatePart(Destination, Vector3.new(1, 1, 1), Color3.fromRGB(255, 135, 114))

	return pcall(function()
		PathObject:ComputeAsync(Start, Destination)

		local m = Instance.new("Model")
		m.Parent = game.Workspace

		for i, wp in ipairs(PathObject:GetWaypoints()) do
			local p = CreatePart(wp.Position, Vector3.new(0.5, 0.5, 0.5), Color3.fromRGB(161, 238, 255))
			p.Parent = m
			p.Name = tostring(i) .. tostring(wp.Action)
		end
	end)
end

--|| Using these results in no path, When the wall in question is at position 1
local StartPos1 = Vector3.new(-66.02659606933594, 2.999999761581421, -44.24205017089844)
local EndPos1 = Vector3.new(-38, 3.5, -32)


--|| Using these results odd waypoint teleporting at position 1 and 2, but not 3 for some reason
local StartPos2 = Vector3.new(-38.06790542602539, 3.125633955001831, -58.612030029296875)
local EndPos2 = Vector3.new(-49, 3.5, -32)



CalculateNewPath(StartPos1, EndPos1)

print("Path Status: " .. tostring(PathObject.Status))

I’m going to submit this as a bug report later today unless someone notices something weird.

Yes, it appears it’s a bug and pathfinding service is being changed to fix them

Running into a wall is fixed, but not being able to find the path is a new one.

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