Pathfinding NPC is really slow (PLEASE HELP ME)

I guess you can then do the line I sent you with the PrimaryPart NetworkOwner

1 Like

@yoshicoolTV I did use that line, thats why its a little smoother (I think)

@PENG_LINMEME Yea but, in what situation? I want the NPC to follow the player at all distances, so I’m not sure what

1 Like

There will always be a delay with path finding unless you use a module like simple path. But ways you can minimize it by putting the path finding before the visuals, since it only moves until the visuals are done. Also you could also try lerping with run service.

rootPart.Position:Lerp(Goal, distance/16 - dt)
1 Like

How does SimplePath achieve no delay tho?

1 Like

You can try asking the creator or look into the source code. I don’t have a good answer.

2 Likes

Just checked the source code, there must be a secret, or something I’m missing , I’m doing basically the same thing, their module moves the npc to the second waypoint and connects a function to the MoveFinished event which moves the character to the next waypoint.

So I don’t know, I will ask them if im allowed to modify their module, but it’s crazy I cant replicate it myself.

(Only thing they did which I did not was using metatables, tho I’m pretty sure that isn’t necessary in this case)

1 Like

Essentially run the path how you would normally. Then after x seconds, find a new path. Once the path is found, cancel the current pathing by disconnecting the :MoveToFinish connection and call :Move(Vector3.new(0, 0, 0) to force the character to stop moving. Then, call your pathfinding logic again with the new waypoints and repeat. Ideally, this all happens on the same frame so it looks like the character never stops moving.

1 Like

I haven’t figured out if this is the issue exactly, but I THINK computing a path yields, so forcing the character to stop moving and then computing a new path wouldn’t run on the same frame

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.