So, after load the glb
file, we can get meshes
and the root mesh
const mesh = meshes[0];
Then we can get all childrenMeshes
from this mesh and set material or color for each one.
A color is applied to each child mesh, except the t-shirt one wich receives a texture.
mesh.getChildMeshes().forEach((childMesh, index) => {
console.log("childMesh.name:", childMesh.name);
const material = new BABYLON.StandardMaterial('material', scene);
// HVGirl_primitive3 == t-shirt
if (childMesh.name == "HVGirl_primitive10") {
material.diffuseTexture = texture;
} else {
material.diffuseColor = BABYLON.Color3.FromHexString(colors[index])
}
childMesh.material = material;
});