Stylistic method of updating positions at real-life time intervals

Hello!

My goal is to update the positions of a large number of entities at a fixed, real-life rate (for performance reasons). The rate would be arbitrary, but probably between 2 and 5 times per second. What would be the preferred method for doing this in Cesium?

My guess would be an onTick listener that compares JulianDate.now() to some stored last update time. Then, I could have my entities’ positions be CallbackPositionProperties that point to a Cartesian3 that the onTick function would update.

This seems kind of hacky, and that may just be because what I’m trying to do is strange. I wanted to ask to make sure there wasn’t a more stylistic method. I don’t want to use simulation time since I want to be able to adjust the simulation multiplier.

Thanks for the help.

Hi @Ben-W,

Welcome to the Cesium community!

I’m not exactly sure what you’re trying to do here, but could it possibly be achieved with a ParticleSystem? If you want to frequently update a large number of objects, that’s probably going to be your best bet for performance, if it works for your use-case.

If that doesn’t work for your case, maybe you could provide a little more detail on what you’re building. Also - when you say “large number of entities” - roughly how many are we talking about here? (I’ll mention right away that an EntityCollection will provide better performance than individually created and managed Entities)

Best,

Matt

Hey Matt,

This would be for satellite visualization, so it looks like a particle system wouldn’t work (unless I’m missing something). Large means 10-20k.

Right now, I’m using a CustomDataSource and adding/removing entities from its default EntityCollection.

I’m exploring this approach because SampledPositionProperties are too slow at high multipliers, and a CallbackPositionProperty calling a propagation function is overkill/also slow. I basically just want a callback property that updates every few ticks instead of every tick.

Thanks,

Ben

Got it. Another followup question - do you know the positions of the satellites ahead of time? Or are they computed / fetched on the fly?

Computed on the fly.

Given the constraints, I think your approach of updating onTick and using a stored time or counter to only update every so often sounds reasonable. Maybe this could even be improved further by batching the updates - so on tick 0, update satellites 0-1k, on tick 1 update satellites 1-2k, etc - to limit the number of updates done on any given frame.

Then, I could have my entities’ positions be CallbackPositionProperties that point to a Cartesian3 that the onTick function would update.

I’m not sure why this part is necessary. I think each satellite’s callback function should be able to handle itself / set its own position. Each callback could maybe do a if currentTime % numBatches or something to figure out if it is its turn to update.

Thanks! You’re right on the last bit, I think my brain was just stuck on some earlier design iteration. I appreciate the help.

1 Like