I’m making something that requires pathfinding service to work across a pretty large range and I was wondering if anyone had discovered a method or a tool that would allow the pathfinding service to extend longer distances. It’s really necessary for what I’m doing so I’d really appreciate all the help I can get!
It claims to be able to pathfind large distances but when I try to do that in practice it usually ends up giving an empty table of waypoints. Works fine at short distances, hopefully someone can assist .
If I am correct your issue has to due with the params being sent to the pathfinding function. As said in the pathfindingservice developer hub page, creating a path requires three parameters to properly work, one of which being agent radius. In short words that determines the distance the path can go. Increasing that should fix your issue.
I also made a pathfinding module called EZ Pathfinding V3 and it should work with long distances if my solution did not work.
Oh wow thanks. I thought the radius parameter was used to determine the radius of the actor (to avoid going through small alleyways if you’re pathfinding for a large semi truck or something). Thanks for the response I’ll be sure to check it out.
Hey, so I’m still having some trouble. I’m trying to create the navigation points between two bricks, and I’m not sure if this is a pathfinding service glitch or what, but even after setting the radius to math.huge, I’m still getting empty results for pathfinding calls that I know should be capable of being fulfilled. Let me upload a video for reference:
See how far away, and even up close, the path is still not being created until the very end? Side note: the path recalculates every time I change the bool value, regardless of whether it’s true or false.
Also, after reviewing the dev forum post I think the radius property may be used for what I had thought initially:
May I see your code so that I can review it. For some reason when I set agent radius higher, the path extended further than normal. It could also mean the separation from the start to end point as in that space contains “obstacles”.
local pathfindingService = game:GetService("PathfindingService")
local function computePath()
local startPosition = workspace.start.Position
local endPosition = workspace["end"].Position
local Path = pathfindingService:CreatePath({
["AgentRadius"] = math.huge,
["AgentHeight"] = 0,
["AgentCanJump"] = true,
})
Path:ComputeAsync(startPosition, endPosition)
local points = Path:GetWaypoints()
local lastPoint
print(points)
for _,v in pairs(points) do
local p = Instance.new("Part")
p.Size = Vector3.new(1,1,1)
p.Anchored = true
p.Position = v.Position
if lastPoint then
p.CFrame = CFrame.new(v.Position, lastPoint) * CFrame.Angles(0,math.rad(180),0)
end
p.Parent = workspace.points
lastPoint = v.Position
end
end
computePath()
workspace.recomputePath.Changed:Connect(computePath)
Sorry for bumping, but alot of developers are refering to this, so I would like to tell something
Agent Radius is the distance to keep as minimum distance away from any obstacle, if you keep it math.huge, then even if there is 1 obstacle in game, then there will be no path