Open aash29 opened 7 years ago
I think the issue is that the last step of path is always the destination, so the default path-following code that applies the next path step to the entity's position will cause this jump. I've been getting around this by having the code that follows the path do a distance check and stop if the distance is 1.5 (to allow for diagonals) or less - or by searching for a path to a tile adjacent to the final destination (in cases where the final destination is impassible). A quick way to do it would be to replace if (path.steps.empty())
with if (path.steps.size() < 2
in the path-following code.
I'll try and come up with a better example later today.
I wanted to slightly change pathfinding algorithm to find a way to cells adjacent to goal. However, setting is_goal function in navigator class to
results in unexpected behavior (stopping 2 steps from goal, then teleporting to it). What is the right way to do this?