Question about ID of merged meshes

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);


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?


Hey! you can change and at will :slight_smile:

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

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?


I have one question, does uniqueId changes on each render or it remains same always?

Always the same :slight_smile:

I am using getTransformNodeByUniqueID to get my slider working, it works on my local host but when I run on another system the unique id number is different. I am not sure if unique id number generate randomly?

Ok gotcha…the uniqueID is unique PER session (ie every time you run the code)

maybe you can use id instead?

Ohh got it, thank you.

Works perfect. thanks.
Using your example. I wrote something as follow
var a = BABYLON.Mesh.MergeMeshes([m1, m2, m3]); = ‘WEB-’+tx+’-’+tz+’-’+hv;