Simple way of cutting out custom shapes from Navigation Polygon for 2D Pathfinding?

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

I am creating a 2D game and want to use Godot’s Path Finding system. I am in the process of creating a very large map with a lot of static shapes (trees and rocks, obstacles) that my game character must be able to find a path to walk around.

The challenge I am facing is with building the Navigation Polygon within the game map. Since the map is so large and has so many obstacles, creating a single Navigation Polygon with a specific shape to cater for each obstacle is very complicated and error-prone; keep in mind that my map design is not ready so the map is constantly changing. This is a very tedious process. I was wondering how else I could approach this problem, for example somehow generating this polygon with a script or perhaps marking each shape as an ‘obstacle’ without having to change the shape of the Navigation Polygon every time I change the map?

Actually, I found a video which describes the problem and a possible solution here in detail https://www.youtube.com/watch?v=uzqRjEoBcTI. But the solution seemed a bit hacky and has some limitations, for example giving inconsistent results and is unable to handle overlapping shapes.