How do I make the object move to a moving object with pathfinding?

I’m trying to use the pathfinding behavior to make an object follow the player by moving to the player’s position, but it only moves to the last position of the player where the player was not touching the platform.

This project might help. It should at least help you visualize what’s happening. The example works best with the cursor keys but you can drag the 1 object that is mostly just an arrow.

Hi, I had the exact same issue, and it was solved in another thread with Keith’s help.
You need to use timers with pathfinding. Check out this thread, it might help:

https://forum.gdevelop.io/t/pathfinding-not-recalculating-and-passing-through-obstacles/

1 Like

Turned out the problem was that the platform the player was standing on was too close to the point on the player the drone was supposed to follow so whenever the drone tried to follow the player while the player is on a platform, it would touch it. Since the platform was marked as an impassable object, it just assumed there was no way to reach the player. Moving the point on the player the drone was supposed to follow slightly higher solved the issue.

1 Like