Hi I wanna clone this loaded object multiple time but i also wanna update material too with new texture mapped. i can achieve that without repeat loader code again and again.
i know how to clone mesh but it’s not updating material.
code is below.
thanks in advance
const Texture = new THREE.TextureLoader().load('/1.jpg');
// immediately use the texture for material creation
const material = new THREE.MeshPhongMaterial({
// color: 0xc8c8c8,
side: THREE.DoubleSide,
castShadow: true,
emissive: 1,
map: Texture
});
const objLoader1 = new OBJLoader()
objLoader1.load(
'/hodlerStandie.obj',
(object) => {
(object.children[0]).material = material
object.traverse(function (child) {
if ((child ).isMesh) {
(child).material = material
}
})
const stand=object;
stand.position.set(-16,0,-5.5);
stand.scale.set(0.02,0.02,0.02);
stand.rotation.set(0,180*(Math.PI / 180),0);
parent.add( stand)
},
(xhr) => {
console.log((xhr.loaded / xhr.total) * 100 + '% loaded')
},
(error) => {
console.log(error)
}
)**strong text**