Hi developers on roblox, I have a question:
How do I get the so-called pathfinding service from roblox to only use certain paths, i.e. given nodes, to make a navigation system
(I tried it with pathfindingmodifier but it didn’t work because I didn’t have any parts can blacklist/whitelist and the terrain as well) The only thing I’m missing is a so-called whitelist system for the pathfindingservice, if you know please try to answer. I appreciate every answer and hope that I will manage it soon. Thanks!
I’m not quite sure what you mean. Can you elaborate a bit more?
Do you mean that the path finding service creates multiple different paths based on distance?
Hey there!
You might find this devforum article useful:
No I mean the path should be generated on a road for example and not anywhere else
I have already seen this post and acually this is my goal but I dont rlly know how to use A* on such this things so I am trying to use the pathfindingservice from roblox, do you maybe know any way to force the Service to only generate a path on given parts?
As part of the PathFinding service, you can add a cost
to parts using PathFindingModifiers. By tagging parts and setting the cost as math.huge, it will encourage PathFinding service to avoid those areas.
How I tend to do this is create parts that cover areas I don’t want NPCs to travel over and add the modifier with a suitable Label:
Then in PathParameters set the cost of these zones as math.huge:
Costs = {
AvoidZone = math.huge,
}
You must ensure that the tagged parts have the CanQuery property enabled.
do you know any way to make it the opposite, so I mean to make it the only part the pathfindingservice should use? If not then I guess this is the solution .
Move the roads up 10 times on the Y axis to move it away from the baseplate. Put the start position on the road and the end position on the road. It should work. After it makes a path, move all the path points down 10 times as if the position of the roads never changed. Move the roads back down too.
I hope this helps.
Pathfindingservice is made for creating path nodes from any input (terrain/obstacles/etc)
If your using pre-made nodes then don’t use pathfindingservice. I suggest you just use Humanoid:MoveTo() on an array
here is some pseudo code
local nodesFolder = --folder full of preset nodes
local hum = --humanoid
for _, node in ipairs(nodesFolder:GetChildren()) do
hum:MoveTo(node.Position)
hum.MoveToFinished:Wait()
end