Can a button be made to change the texture gltf using three.js or javascript?
examles
Can a button be made to change the texture gltf using three.js or javascript?
examles
It’s possible.
You can log the object and identify the meshes you want to modify material of, then change the value of material maps.
Please answer me
It should be something like this. You load the texture via the Texture Loader and apply it to a child mesh.
An example code:
wardrobeLoader2 = new THREE.TextureLoader().load('./textures/table42/textures/wardrobeorig.png');
gltfLoader.load('./textures/table42/scene.gltf', (gltf) => {
wardrobe = gltf.scene;
wardrobe.traverse(function(node) {
if (node instanceof THREE.Mesh) {
node.material.map = wardrobeLoader2;
}
});
scene.add(wardrobe);
});
Thank you so much