[SOLVED] How to set metalness in code?


#1
this.entity.model.meshInstances[0].material.setParameter('material_metalness', 0.122);
this.entity.model.meshInstances[0].material.update();

I wanted to change the value of metalness during runtime, but it didn’t work.
When i use gettParameter(‘material_metalness’),i see the material_metalness has been changed,but the material has no effect.


#2

I have changed it to:

var material = this.entity.model.meshInstances[0].material;
material.metalness = 0.107;
material.glossiness = 19;

It works.