[SurfaceTool] How to join several meshes together?

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

Hi, i want to merge some meshes and i tried something like this:

SurfaceTool surf;
MeshInstance MeshCache[16]; //filled MeshCache with some cubes

void MyMeshInstance::addMeshFromCache(int x)
	if (get_mesh() != NULL)
		surf.create_from(get_mesh(), 0); //get existing mesh(!?)

	// add new mesh & set it:


for (int x = 0; x < 16; x++) // than do this:

But it dont work.
If i look ingame, it only draws the last two cubes of the array.
And i dont understand why?

Is this the right way or is there a better way to do this?

thx a lot :slight_smile:

:bust_in_silhouette: Reply From: MysteryGM

Use the MultimMeshInstance from Godot instead. See: https://forum.godotengine.org/19366/how-to-use-multimeshinstance

But multimesh instances, do not support multiple material types, which is why surface tool would be used in the first place.