#My pathfinding is laggy..?
1 messages · Page 1 of 1 (latest)
Maybe because u say char.humanoid:movetofinished:wait()
i feel like this is written way too complicated
yeah, I would just simply update :MoveTo every frame (RenderStepped) without waiting
same
he wants pathfinding so that it can pathfind around objects
i have had the same issue before, or relatively the same issue, so i recommend maybe keeping the character moving WHILE processing a new path because the process is probably holding up the time until he moves again creating that.
** You are now Level 2! **
ah so you're saying that the UpdatePath is taking time and thus pausing every step?
i'll try that later
Prbably
ok i updated the Step function to Updatepath before waiting for the character to finish walking and the problem still persists, anyone got any ideas on why?
ok i just outright removed the MoveToFinished and it seems to work (along with other changed like replacing while loop with Stepped purely just because i dont like while true do loops)
ok now im testing out different speeds
but if i set it too fast there are like pauses (because the waypoints are simply too close to eachother)
wondering if theres a way to chang ethat?
you can try calculating the distance between waypoints and the amoun t of time it would take to traverse them using humanoid's walkspeed
then using that to wait
u are updating the path every stepped?
that will cause lag and stutter
what u want to do is
save the target position of the path right
then check if the target position of the path and the distance between the target is over a certain amount
if so then recalculate the path
else continue on the path
so only recalculate path when the target moves?
.
exactly
oh boy alright then