Changing the color of a material at runtime

Hi,

The color getter and setter api is confusing. It would be helpful if the examples there was little more clear than just hardcoding an array of numbers.

I tried this and I didn’t get to know how I implement the color setter and getter here.

const Color1 = parent;
const Zappar__Helmet = symbol.nodes.Zappar__Helmet;

parent.on("pointerdown", (e) => {

	var color: {
(val: number[]):Color1.color;   //Getting the color of the parent object.
};
	Zappar__Helmet.nodes.visor_mat_PBR.color(color);  //Setting the color to the 3D model.

});

Got it. Found a reference in this link for getters and setters. Here is the solution.

var color = Color1.color();
	Zappar__Helmet.nodes.visor_mat_PBR.color(color);
1 Like