callbackproperty cesium

Hi
I am using a calback to update a model and thus avoid repainting the entire entity again.
The problem is that the callback is being called all the time (as is logical). Is there any way to stop and reactivate a calback?

Regards

You can’t “stop” a CallbackProperty, because it’s not an update function. It’s more like a getter. So if you had a CallbackProperty on the position, every time any part of the code does:

entity.position.getValue(time);

``

The CallbackProperty will be called (so this can be 1 time per frame, 0 times per frame, or multiple times per frame).

What I would do instead is have an if statement check for some condition at the beginning of the CallbackProperty if you want it to not update the value. Although that still means the callback property will be called and the entity geometry or material may be recreated. Alternatively you could change the position to a constant property (either manually or by using a composite property, so that it’s constant at some time intervals, and it’s a callback property at other time intervals).