So I’m working in babylon.js (but is more a js problem at this time) my problem is that I need to change a variable name dynamically but taking the index of both for that.
Here, let me show you the array in fact:
for (let i = 0; i < torresIndex; i++) {
for (let j = 0; j < repTorre[i]; j++) {
piso = BABYLON.MeshBuilder.ExtrudePolygon("piso"+i+j, {shape:torre[i], depth: 1, sideOrientation: -1 }, scene);
piso.position.y = factorTamano++;
factorTamano = factorTamano++;
piso.material = materialforSolidPolygon;
piso.enableEdgesRendering();
piso.edgesWidth = 4.0;
piso.edgesColor = new BABYLON.Color4(0, 0, 0);
}
}
“piso” is an array variable outside of the loop.
So the idea in question is that the name of the variable “piso” change dynamically according to the position of “i” and “j”
The expected result is this:
i=0 j=1
piso01
i=0 j=2
piso02
......... and so on.
The end result in general that I want is that I can call the shape in question and take their vertices to work it out individually in another for loop.