get_simple_path gets entities stuck

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Jan Krüger

Hello,

I have recently started using this engine with a couple of friends to make a game. Today we run into an issue. The Navigation2D#get_simple_path method seems to not take into account the dimensions of the various shapes it encounters while calculating the path, this causes entities to get stuck in our game. They get moved with the move_and_slide method.

I invested some of my time researching this issues and it seems as if it even dates back to as far as 2015 with various GitHub issues mentioning it but not one (at least I didn’t spot one) offered a solution. I even read a post that said that a fix was planned for Godot 2.2, so quite some time ago. - Is there a better solution than implementing our own pathfinding algorithm or is there an ETA for a fix?

Thanks for your time.

:bust_in_silhouette: Reply From: Zylann

It is recommended that your navigation polygon(s) include a safe margin towards walls, in order to take the agent’s size into account. This isn’t ideal because you have to choose it carefully depending on which variety of agents you have, and it has to be manually taken into account when setting it up. However that’s a good solution for now and has been working fine for my 2D game with AIs :slight_smile:

I think 3D has a margin parameter for that same purpose, maybe it just needs to be added in 2D. I think this issue refers to it 2D pathfinding collision avoidance (with walls and obstacles) · Issue #1887 · godotengine/godot · GitHub
No ETA AFAIK, someone just needs to do it.

Thank you for the answer. I tried it and it worked ok-ish for me. I replaced it now with an AStar based system, which is significantly slower, but I let the entities queue navigation jobs and process them on another thread.

Jan Krüger | 2018-05-31 12:40