Change the color of an object via a trigger

This is something that could be implemented using the viewer API but would require custom HTML/JavaScript coding. Unfortunately, we cannot provide you with a complete example (see: About the Customization category), but with regard to our API such a snippet allows you to change the material color:

var material = viewer.findMaterial('<MATERIAL-NAME>');
material.baseColor.setRGB(<R>, <G>, <B>);
material.setUniforms();
viewer.requestFrame();

provided that before the scene is loaded you mark the material as editable:

var viewer = WALK.getViewer();
viewer.setMaterialEditable('<MATERIAL-NAME>');
1 Like