Pathfinding AgentRadius is wrong and/or default parameters are documented wrong

According to the DevHub page, the default agent parameters of the pathfinding service are AgentRadius = 2, AgentHeight = 5, and AgentCanJump = true.

It looks like either these given defaults are wrong, or the PathfindingService is using the radius argument wrong. Radius 2 should be able to fit through a 4 stud wide gap, but it doesn’t. It needs to be less than 1.75 to fit through the 4 stud gap.

When I use the pathfinding service without using any parameters at all, the pathfinding service works as it should.

pathservice:CreatePath()

However, when I manually put in agent parameters which have the same values as the defaults listed on the DevHub, no path can be calculated.

pathservice:CreatePath({AgentRadius = 2, AgentHeight = 5, AgentCanJump = true})

To get the closest behavior to what the defaults appear to be, I have to use the following:

pathservice:CreatePath({AgentRadius = 0.98, AgentHeight = 5, AgentCanJump = true})

Here is the code used in the repro file.
To make it work, all I do is use the nil or guesstimated “details” variables.

local details = {AgentRadius = 2, AgentHeight = 5, AgentCanJump = true} -- DevHub-given defaults
--local details = {AgentRadius = 0.98, AgentHeight = 5, AgentCanJump = true} -- Guesstimated actual defaults
--local details = nil -- No argument, use built-in defaults

local pathservice = game:GetService("PathfindingService")
local path = pathservice:CreatePath(details)
local points = {}

while wait(0.3) do
	path:ComputeAsync(workspace.start.Position, workspace.theend.Position)
	print(path.Status)
	local waypoints = path:GetWaypoints()

	for i, v in pairs(points) do
		v:Destroy()
	end
	points = {}
	
	for i, v in pairs(waypoints) do
		local part = Instance.new("Part")
		part.Name = "waypoint"
		--part.Shape = Enum.PartType.Ball
		part.Color = Color3.new(1, 1, 1)
		part.Material = Enum.Material.Neon
		part.Anchored = true
		part.Size = Vector3.new(.5, .5, .5)
		part.Position = v.Position
		part.CanCollide = false
		part.Parent = workspace
		
		table.insert(points, part)
	end
end

This bug works every time, and I tested it in Studio and in a game. My computer runs Mac 10.14.6.

pathfind.rbxl (19.6 KB)

10 Likes