For it to be more understandable when it happens:
When the part is moved, another path is created.
While its being created, the NPC stops to compute the path which lasts for a few miliseconds
if the part is moved a lot, the NPC will keep stopping for few miliseconds to recompute the newly generated path.
if there’s any sort of delay when creating and computing the path, try removing it or changing it to be a lot more faster. To replicate this issue, move the goal a lot with your mouse really fast.
Unfortunately, that’s how long it takes PathfindingService to compute a new path. If I try to remove or reduce the wait time somehow, it ends up overlapping with other parts of the script and overshoots the waypoints (the same issue you first noticed) and ends up colliding with obstacles instead of going around it. The maximum you can do is disable path visualization and only notice the ever so slight stutter:
alright. Do you have any solutions to a way to reduce the high intense stutter of the SDC to the same/similar results as the non custom rig like in the video?
Yes that stuttering is all that I can do for now. I’ll continue to make changes to the script and hopefully find a solution in the future. I’m not entirely worried about this since the main purpose of Run() is not to continuously create a seamless path for the humanoid. Rather, it was created to make it easier for people so they dont have to worry about stopping the path before creating a new one.
Anyway, I’m glad you caught that fatal bug and I hope my module will be of use in your projects.
SimplePath.new() saves the Path object at default. This can now be disabled (see api). Disabling this feature maximizes the performance but the Path object specific to the rig will not be retrievable (if the Path object was saved, it is automatically retrieved if you run Path.new() on the same rig).
by the way, i have a suggestion:
maybe you should add an option that when enabled, makes the pathfinding NPC try their best to go to a player/humanoid npc and have the humanoid be customizable, because it is kinda difficult to have it chase NPCs due to the fact that i have to manually edit the code and it only chases npcs to their last position and it’d be quite helpful if this was added
You should make this more compatible with bigger Humanoids. I tried using it on a character that is 1.5x bigger than the average player, and even after changing the AgentHeight and AgentRadius, the character would walk backwards to the starting node every time I would change its goal. But, I found a workaround.
local path
while true do
path = SimplePath.new(script.Parent, {AgentHeight = 7.5, AgentRadius = 3, AgentCanJump = true})
game:GetService("RunService").Heartbeat:Wait()
local goal = FindNearestTorso(script.Parent.Torso.Position)
if goal then
path.InitialPosition = script.Parent.Torso.Position + (goal.Position - script.Parent.Torso.Position).Unit * 2
path:Run(goal.Position, false)
end
end
Hey, thanks for the feedback! When you execute the Run() function, the module calculates the timeout of the rig using walkspeed and rig size. So say if the rig needs to jump in order to reach the next waypoint. In this case, it can be detected by the module when the rig doesn’t reach the next waypoint within the calculated time. If there’s a timeout, the rig jumps automatically. So you don’t need to worry about making the pet jump. It will jump itself.
Edit: I had to add this feature since roblox autojump doesn’t work always and is unreliable.
Oh I thought you meant if it jumps over an obstacle like an inteference blocking the path. In that case, the module doesn’t make the rig jump over gaps. It doesn’t because roblox’s pathfinding service does not support that.