I have a C# script that creates a random 2D array that is a map for a cave system.
Sample Map:
11111111111111111111111111111111111111111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111111111111111111111111111111100011111
11111111111111111111111001111111111111111110111111111111111111111111110000000111
11111111111111111111110000011111111111111100001111111111111111111111000000000111
11111110000000111111100000011111111111111000000010111111111111110101000000000111
11111100000000011111110000000111111111111000000000011111111111100000000000000111
11111000000000001111100000000101111111111000000000000111111111100000000000000111
11110000000000000111110000000000011111111100000000000111111111110000000000000111
11110000000000000111100000000000000111111111100000000111111111110000000000000111
11100000000000000111110000000000000111111111110000000111111111111000000000000111
11100000000000000111100000000000000011111111110000001111111111100000000000000011
11000000000000000111110000000000000011111111110000000111111111000000000000000011
11000000000000000111100000001000000001111110000000001111111110000000000000000011
11000000000000000001000000111100000001111100000000001111111100000000000000000011
11000000000000000001000000111100000000111000000000000111111100000000000000000011
11000000000000000000000011111110000001111000000000001111000000000000000000000011
11000010000000110000000011111111111011110000000000000110000000000000000000000011
11000011111111111000000011111111111111110000000001001100000000000000000000000011
11100001111111111000000011111111111111110000000011100100000000010100000000000111
11100000011111111100000011111111111111110000000011100000000000111110000000000111
11100000010101111000000000111111111010100000000111111000000000111111000000001111
11100000000000011100000000101111110000000000001111111100000001111111100000011111
11100000000000000111000000000111111000000000000111111110000011111111100000011111
11100000000000011111110000000011111000000000000111111111111111111111000000011111
11000000000000011111111100000111111110000000000011111111111111111110000000011111
11000000000000011111111100000111111110000000000011111111111111110000000000011111
11100000000000001111111110001111111111000000000001111111111111100000000000001111
11100000000000001111111100001111111100000000000001111111111111110000000000000111
11110000000010000011111100001111111100000000000001111111111111110000000000000111
11100000011111000000000000001111110000000000000001111111111111110000000000000111
11111111111111110000000000000111110000000000000001111111111111110000000000000111
11111111111111100000000000000000000000000000000000111111111111110000000000000111
11111111111111110000000000000000000000000000000101111111111111110000000000000111
11111111111111100000000100000000000000000000011101111111111111110000000000000111
11111111111111100000001111000000000000000000011111111111111111111000000000001111
11111111111111100000011111000000000000000000011111111111111111111100000000001111
11111111111111111000011111100000000000000000111111111111111111111110000000000111
11111111111111111110111111110001011111111111111111111111111111111111111110000111
11111111111111111111111111111111111111111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111111111111111111111111111111111111111
It uses 0 for the passages and 1 for the walls.
I want to turn it into a 3D shape for the player to walk through.
I got something like it working in Unity, but I'd really like to port it to Godot.
This is what the cave looked like in Unity:
I had someone recommend using CSG shapes to create it, like a CSGPolygon3D, which can be used to subtract from a larger shape and carve the cave out.
I can see it having a lot of advantages that I didn't know how to solve with the unity solution, though I've also heard that CSG shapes should only be used for prototyping.
The big problem I'm running into is finding a way to turn my 2D array into a Polygon3D. I've tried a few different things but none of them seem to work out.
