我对某些应该相当简单的事情有困难。我通过json加载器有一个几何体。我想复制这个几何体并将材质的修改版本应用于每个几何体。我已经尝试遍历分组的对象。两者都需要共享json文件中的材料。唯一的区别是材料[9] .map和材料[9] .emmissiveMap的价值。任何帮助或指导都会非常感激。
loader.load('chris/7.json', function(geometry, materials) {
for (var k in materials) {
materials[9].map = ballerina;
materials[9].emissiveMap = ballerina;
}
mesh = new THREE.Mesh(geometry, materials);
mesh.scale.x = mesh.scale.y = mesh.scale.z = 282.75;
mesh.translation = geometry.center();
mesh.rotateZ(90);
mesh.geometry.uvsNeedUpdate = true;
mesh.material.needsUpdate = true;
iphone2 = new THREE.Mesh(geometry, materials);
iphone2.scale.x = iphone2.scale.y = iphone2.scale.z = 282.75;
iphone2.translation = geometry.center();
iphone2.rotateZ(-24.7);
iphone2.position.z = -120;
iphone2.position.x = -120;
iphone2.geometry.uvsNeedUpdate = true;
iphone2.material.needsUpdate = true;
group.add( iphone2 );
group.add( mesh );
scene.add( group );
});