I have a mesh1 and a mesh2 that’s cloned from mesh1.
I want to update the texture of mesh2 like the following code, but it updates the texture of mesh1 as well. How do I change the texture of only mesh2?
const textureLoader1 = new THREE.TextureLoader();
const texture1 = textureLoader1.load('path/to/image1.jpg');
const mesh = new THREE.Mesh(
new THREE.PlaneGeometry(width, height),
new THREE.MeshBasicMaterial({map: texture1, side: THREE.DoubleSide})
);
const clonedMesh = mesh.clone();
const textureLoader2 = new THREE.TextureLoader();
const texture2 = textureLoader2.load('path/to/image2.jpg');
clonedMesh.material.map = texture2;
clonedMesh.material.map.needsUpdate = true;
Thanks in advance.