AgentRadius not working

I am setting up a PathFinding system so I can start learning it, but for some reason, the “AgentRadius” just won’t work as it should. It just does not make difference at all.

Without AgentRadius:

With AgentRadius (at 6):

This is the script:

wait(1)

local PathfindingService = game:GetService("PathfindingService")

local npc = script.Parent
local humanoid = npc:FindFirstChild("Humanoid")

local goal = workspace.goal

local path = PathfindingService:CreatePath({
	AgentCanJump = true,
	AgentRadius = 6,

	Costs = {
		Wood = 1,
		Neon = 2,
	},
})

local success, errorMessage = pcall(function()
	path:ComputeAsync(npc.HumanoidRootPart.Position, goal.Position)
end)

if success and path.Status == Enum.PathStatus.Success then
	for _, waypoint in pairs(path:GetWaypoints()) do
		local part = Instance.new("Part")

		part.Material = Enum.Material.Neon
		part.Anchored = true
		part.CanCollide = false
		part.Position = waypoint.Position
		part.Shape = Enum.PartType.Ball
		part.Size = Vector3.new(1,1,1)

		part.Parent = workspace

		humanoid:MoveTo(waypoint.Position)

		if waypoint.Action == Enum.PathWaypointAction.Jump then
			humanoid.Jump = true
		end

		humanoid.MoveToFinished:Wait()
	end
else
	warn("errorMessage", errorMessage)
end

Your agent radius should probably be a bit smaller as 6 studs seems to be very large for the current pathfinding agent. You have also set material costs for wood and neon, but the part of the platform the agent is on that is not a kill brick does not look to be wood. Try setting the material cost of the platform’s material (not the killbrick) to 1 and neon’s cost to math.huge.

Just for reference the radius of the outer collision box for a standards R6 blocky humanoid is 4 studs while the radius of the inner is 2 studs.

1 Like

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