Estoy trabajando en cargar modelos múltiples con tres js y aplicar texturas. Pero ahora, el modelo múltiple se carga con el código, pero la textura no se aplica al modelo cargado, ¿cómo lo soluciono?
este es mi github https://github.com/OKYOUNGBIN/Threejs_Web.git
por favor, ayúdame
function setMaterial(parent, type, mtl) { parent.traverse((shadow) => { if (shadow.isMesh && shadow.nameID != null) { if (shadow.nameID == type) { shadow.material = mtl; } } }) } const loader = new GLTFLoader; loader.load(MODEL_PATH1, function (Top) { console.log('success') console.log(Top) theModel = Top.scene; theModel.traverse((Top) => { if (Top.isMesh) { Top.castShadow = true; Top.receiveShadow = true; } }); theModel.scale.set(3, 2, 2); theModel.position.y = -1; for (let object of INITIAL_MAP) { initColor(theModel, object.childID, object.mtl); } scene.add(theModel); }) const INITIAL_MTL = new THREE.MeshPhongMaterial({ color: 0xf1f1f1, shininess: 10 }); const INITIAL_MAP = [ { childID: "mesh_0", mtl: INITIAL_MTL }, { childID: "mesh_0_1", mtl: INITIAL_MTL }, { childID: "shelf_0301_t50_h600_w600_frame", mtl: INITIAL_MTL }, ] function initColor(parent, type, mtl) { parent.traverse((shadow) => { if (shadow.isMesh) { if (shadow.name.includes(type)) { shadow.material = mtl; shadow.nameID = type; } } }) }