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)
{
surf.clear();
if (get_mesh() != NULL)
surf.create_from(get_mesh(), 0); //get existing mesh(!?)
// add new mesh & set it:
set_mesh(surf.commit(MeshCache[x].get_mesh()));
surf.clear();
}
for (int x = 0; x < 16; x++) // than do this:
addMeshFromCache(x);
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 :)