Question about ID of merged meshes


#1

Hi there,

in my current project I need to tell BJS the names (actually IDs) of meshes, that I want to create.
The names are chosen by my App like this:

var srmName = null;     // mesh ID für die RBGs
var lhaName = null;     // mesh ID für die LAMs

for (var middleValue = 0; middleValue <= aislePositionsZ.length - 2; middleValue++){

    srmName = "SRM-" + middleValue;             // Nummerierung RBGs
    lhaName = "LHA-" + middleValue;             // Nummerierung LAMs

    srmX = aislePositionsZ[middleValue];

    let newSRM = new SRM(srmX, srmY, srmZ, srmName, lhaName, multiMaterial, rackRowLength, scene);
        newSRM.drawSRM();

};

My problem is, that my class creates merged meshes which IDs are like “(…)_merged”.
The first part of a merged mesh´s ID is based on the ID of the first mesh in my “merging array”.

My code is like:

var finalLHA = BABYLON.Mesh.MergeMeshes(lhaMerge, true, true, undefined, true);

I know 'I could use tag-system for this, but I want to know:

  1. How can I pick the ID by myself when I create a merged mesh?

  2. Is there a way to change a mesh´s ID?

Thanks,
Topper


#2

Hey! you can change mesh.name and mesh.id at will :slight_smile:

you can also consider using mesh.uniqueId which is guarantee to be unique across the scene


#3

https://www.babylonjs-playground.com/#1IDZCU#10

Wingnut goofing around, as usual. :slight_smile: Wingnut looks-over DK’s shoulder… to see if he is having a healthy lunch. :slight_smile: Are those… bison tacos?