Hello everyone,
I’m experimenting with an example to see if I can get meshes to load randomly from an array.
Here’s the PG: https://www.babylonjs-playground.com/#QY1WYT#0
“Dude” has 5 submeshes. The code I tried below is in bold.
I tried making an array for the submesh numbers…
meshArray = [0,1,2,3,4];
Then tried adding code that would select a random number from that array…
// Dude
BABYLON.SceneLoader.ImportMesh(“him”, “/scenes/Dude/”, “Dude.babylon”, scene, function
(newMeshes2, particleSystems2, skeletons2) {
var dude = newMeshes2[meshArray[Math.floor(Math.random() * meshArray.length)]];
The last bit of code is obviously incorrect because it doesn’t work, but I’m not sure how to get only 1 submesh from the set of 5 to to randomly load