I’d like to get the polygons describing these multiple lakes and then “empty” / “fill” the lakes independently of each other. At the moment they are all represented by one plane of reflective water:
I think I need a function that intersects a plane with a mesh and returns all the complete and incomplete intersections with that mesh. Perhaps there’s a solution using getClosestFacetAtCoordinates or some linear algebra but this is not a strong point for me. If it could also close the polygons / join together multiple polygons that overlap the “edge” that’d be super helpful as I definitely have no idea how to do that performantly or robustly.
I asked an AI to produce me some code and after many errors it gave up and I’m left with “e is undefined” as an error https://playground.babylonjs.com/#B7U1UY#1 or https://playground.babylonjs.com/#B7U1UY#3 (uncomment lines 32 to get an error). Any help appreciated.