Godot Version
Godot 4.2.2 stable
Question
I’m making a game based around destructible 2d polygons, using the Geometry2D.clip_polygons etc to interact with the polygons. One thing I’ve noticed is that there’s cleanup inherent to the functions - if you create a block that digs through a polygon as it moves, it will NOT leave a vertex for every frame it runs the clip function - the clip will clean up as it goes to keep the vertext count low. This is obviously generally a good thing.
However, I can’t control it directly(?) and the cleanup is potentially destructive. Ultimately, I intend to draw polyline2D as outlines to the terrain polygons. I also need to be able to have ‘holes’ in the levels, to keep possibilities in level design open. In an attempt to prep for this I made the level as pictured :
The idea is to iterate through the vertices of the polygon and see that 3-4 and 11-12 are identical (a “seam”), then use that data to determine where and how to draw the outlines. However, with this setup, the first time clip_polygons is run, it will recognize that 3-4 and 11-12 are identical, seemingly merge those vertices, then return a polygon shaped like 1, 2, 12, 13, …1, as well as a polygon 4, 5, 6, 7, 8, 9, 10, 4 (the ‘hole’) as a result of the clip_polygons function.
Given that, my questions are as follows:
Is rewriting the clip_polygons function in C++ going to be a horrible pain in my butt and not a clean solution to my issue?
Is there some simpler way I should be setting up my project fundamentally, given that “Terrain with holes/voids” is a necessary part of level design?
Is “Polygons with holes/voids” actually possible, and I just haven’t learned how yet?