Change Material on 3D object with a button

Hello,

I need to change the whole material of the 3D object with a button.
Button marble, button aluminium, etc…
Once is clicked, it changes the material, not only the main texture.

Not only the diffuseMap like it can be done with skin property.

Does some body know how to do it by coding?

Thank you in advance

1 Like

Resolved…

On my 3D Object: New script


const Mrmol_Valencia = symbol.nodes.Mrmol_Valencia
const Lunares = symbol.nodes.Lunares

export function MarmolTexture (){
parent.skin (Mrmol_Valencia);
};

export function LunaresTexture (){
parent.skin (Lunares);
};


on my scene:
Script on Button Marbel


const ESCULTURA = symbol.nodes.ESCULTURA;
parent.on(“pointerdown”, (e) => {
ESCULTURA.nodes.CambioTextura.MarmolTexture();
});


Script on Button Lunares


const ESCULTURA = symbol.nodes.ESCULTURA;
parent.on(“pointerdown”, (e) => {
ESCULTURA.nodes.CambioTextura.LunaresTexture();
});

3 Likes