I’m using the pathfinding service to make npcs walk from part to part and I’ve notice that it’s generating the waypoints in a way that makes it very inefficient for the npc to walk to the destination.
Here’s what I mean: This shows the path the npc should take (blue), compared to the path that the npc actually takes (purple)
Here’s another example: The npc is walking from the yellow part to the green part but takes an unnecessary detour.
Instead of going in a straight line from A to B, it jumps over the stair railing, struggles to climb up the stairs and finally onto B. How can I make it so that it takes the most efficient route to B?
Here’s the waypoint generation code if you want to see. Just normal waypoint generation.
local path = PathFinding:CreatePath()
path:ComputeAsync(npc.HumanoidRootPart.Position, tycoon.Pathfinding[PfPartData2.Object].Position)
local waypoints = path:GetWaypoints()
for _, waypoint in pairs(waypoints) do
npc.Humanoid:MoveTo(waypoint.Position)
end