Does AStar2D take one frame to take disabled points into account for path?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Ox0zOwra

I’m trying to get a path from one point to another, disabling points and getting a new path within the same frame when they don’t fulfill certain requirements. AStar2D completely ignores the disabled points, however, and provides the same path every time, which ends up causing an infinite loop (I’m using a while loop for this, but I think it’s necessary here). I’ve noticed the points do get disabled, though - it just doesn’t seem to care.

Using await, on the other hand, doesn’t solve the issue at all as my pathfinding enemy ends up not doing anything. He doesn’t even get the path.

So is AStar2D incapable of giving me a new, different path within the same process frame or am I doing something wrong?

:bust_in_silhouette: Reply From: smix8

The AStar2D/3D classes have no path cache and every function like set_point_disabled() runs immediately, not deferred.

That said AStar2D/3D classes are also entirely single-threaded and only a single path query can be done at the same time because the path search places temp data on the points.

You are my freaking savior, THANK YOU. Where did you find this out? I was trying to read about it in the Godot docs, I even went into the engine’s source code for AStar, and I couldn’t figure it out.

Ox0zOwra | 2023-06-08 22:49