Change the color of an object via a trigger

Hi guys !

I’m trying to change the color of an object via a trigger.

Material Picker does not suit me because you have to choose the color.

I am creating an Echop 360 for a client who sells notebooks with different variations; Choice of format (A4, A5…), choice of cover, and finally choice of interior. Of course I want to use 3D to give interaction to the selection and display the right command button but I’m stuck…

My goal (my thought…):

Multi Trigger “test1” use for:

  • Put color 1 on material 1
  • Show cart button 1

Multi Trigger “test2” use for:

  • Put color 1 on material 1
  • Show cart button 2

Ideas ?

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