So I am using the Procedural Mesh Component, and my goal is to use functions that will give me a structure in the form of a custom 3D array that indicates the locations of the cubes to create. I want to develop a voxel generator, however, I am having difficulty merging the vertices and triangles generated by the Generate Box Mesh function into one larger mesh.
This is a stitched-together screenshot of my current code. The base structure is there, and I have verified that my function is returning the locations of cubes (as positions in a custom array structure) as expected.
However, when I attempt to combine all vertices into one temporary array, and then all triangles, I always wind up with one generated cube mesh being rendered, as seen below, instead of the larger, combined mesh I am expecting.
I am not sure where I am going wrong with how I am combining vertices. I was under the impression that if I add all points into one array, it would work, but that is obviously not the case!
I also know that to actually improve upon this basic idea that I will need to remove redundant vertices and merge triangles, but I just want to complete this basic idea of “one large mesh” before I continue onto optimization.
Now, I’m not bending on the Blueprints. My idea for procedural generation is based solely on building complete, small dungeons, from blocks-built parts (for example, a table would be generated and placed around the dungeon), however, because the idea of merging cubes is more of a logical problem than a code-one, I figure even those who’ve built these parts in C++ should be able to point me in the right direction!