How to update model when changing their properties

My issue:
When I changed the existing entity.model’s color I can’t see the view updated, only drag the model in browser I can see the color changed

I have used three methods:
entity.model.color = getColor(“green”, 0.4);
or entity.model.color.setValue(getColor(“green”, 0.4));
or entity.model.color = new Cesium.CallbackProperty( function(){return getColor(“green”, 0.4);}, true);

Why is that, Is my way wrong or others? how to correctly update or refresh the changed model?

my model: entities.add and .glb format
my browser:chrome 93.0.4577.82 (64 bit)
my cesium version: 1.85

Thanks in advance.

@yancy

Welcome to the community! :grinning: :rocket: Questions related to entities are very common as folks get started with CesiumJS. Can you please send over a sandcastle demo that showcases what you have so far? This will help me have a better understanding of your implementation. I am looking forward to learning more!

-Sam

1 Like

@sam.rothstein Thank you very much,the sandcastle is realy useful! When I try to send over a sandcastle demo, I solved my problem in the process! It’s really exciting!

The solution:
entity.model.color = getColor(“green”, 0.4);
viewer.scene.requestRender(); // this is point!

Hope my experience can help others:
When “requestRenderMode:true”,we can use “viewer.scene.requestRender()” to update the model when needed.
Or another way directly make “requestRenderMode:false”.

Refer to the connection
https://cesium.com/learn/cesiumjs/ref-doc/Scene.html

Thank @sam.rothstein again at last.

@yancy

I apologize for the delayed response - I was at GEOINT all of last week. I am happy to see that you resolved your issue. Experimenting with sandcastle can be very helpful. :grin: :rocket:

-Sam