You can write your topic however you want, but you need to answer these questions:
-
What do you want to achieve? Keep it simple and clear!
I want to find a path around a race track that starts and ends at the finish line -
What is the issue? Include screenshots / videos if possible!
pathfinding service will not find a path around the track, despite having no obstacles in the way. path.Status keeps returning Enum.PathStatus.NoPath -
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I’ve tried putting a giant wall on the finish line and the ending point behind it, with the starting point in front of it so that way the service is forced to find a path around the track but unless the shortest path requires not going through the wall, it cant find it. I’ve tried using pathfinding modifiers to no avail
my code is as follows:
local PathService = game.PathfindingService
local Path = PathService:CreatePath({AgentRadius = 3.482, AgentHeight = 2.635, AgentCanJump = false, WaypointSpacing = 4, Costs = {FinishLine = math.huge, ThroughArea = 1}})
Path:ComputeAsync(Map.PathFindingParts.Start.Position, Map.PathFindingParts.End.Position)
if Path.Status == Enum.PathStatus.Success then
for _,object in pairs(Path:GetWaypoints()) do
local clone = Instance.new("Part")
clone.Parent = workspace
clone.Size = Vector3.new(1, 1, 1)
clone.Anchored = true
clone.Position = object.Position
end
return false, "Success!!!"
end
the blue dot is the starting point
the pink dot is the ending point
the yellow line is the giant wall i have
the white line is the path its supposed to take
the grey line is the path it wants to take, and fails if it cant take it
the red blocks have canquery off and have pathfinding modifiers with a cost of 1 (default)
h
this is what it looks like when i move the ending point (pink dot) a bit closer the the starting point