I’m trying to update an entity that I’ve added to viewer.entities, and it seems to be periodically duplicating the entity as the scene renders. Here’s an example using the Sandcastle Circles and Ellipses demo. Just add this to the bottom and run it:
Thanks for the bug report. I’ve seen this recently as well and it’s definitely a bug.
One thing I will mention is that if you are animating entities then you’ll want to use a corresponding time-dynamic property rather than just keep setting new constant values. For example, SampledProperty or CallbackProperty. This is an area where doc is lacking in Cesium, but I’m planning a tutorial on using the time-dynamic aspects of Cesium some time soon, so keep an eye out for it. If you can provide some more info on your use case, I can probably make some suggestions in the mean time.
It uses a callback property while it’s updating so that the geometry is treated as dynamic. Then once editing is done, it stores the final values as static.
There’s definitely room for improvement in the entity API in this area; but writing an interactive editor should be possible with what’s currently there.
Only issue is that it seems like it takes about 4 static entities before Cesium is “warmed up”, otherwise there is a lag between finishing the draw and displaying the new static entity. If I use minified source, the lag is only about half a second so it’s not much of an issue, but in development it can be a few seconds. Seems to be related to the number of cesiumWorkerBootstrapper threads active. Once it hits 5 threads, the lag goes away. If I tell Cesium the static entity has dynamic callback properties, the lag also goes away.
Just to add my voice on this one… i think i am seeing the same bug. I have a transparency slider where i do this:
var color = entity.polygon.material.color.getValue();
color.alpha = opacity;
entity.polygon.material.color.setValue(color);
as the slider moves (with varying values for ‘opacity’)… it works 90% of the time but occasionally (after ~20 secs of playing with the slider) i am seeing duplicate entities appearing in scene.primitives.
i’m struggling to produce a sandcastle to reproduce this unfortunately. could it be related to the same problem ?