Using multiple Clocks for different simulations

I’m trying to find a way to use a couple of Cesium.Clocks to control two simulation independently of the main viewer clock so that I can pause or speed up each simulation independent of each other (and independent of the sun position). Is there a way to get the viewer to call .tick() on several different clocks or is there another way to achieve what I’m trying to do?

Dag

I think you might have to create your own render loop as described here.

Then you should be able to call .tick() on both, either, or none in the way you need.

I solved it by creating a list of clocks and then in the event handler for viewer.clock I loop though that list and call tick on each clock. I can then start and stop clocks by adding and removing clocks to that list.

Dag

1 Like

Hi Dag_Wastberg,

Now, I am facing the same problem like you were. I have two animated trajectories triggered by two buttons. The trajectories were loaded by Cesium.CzmlDataSource (), and they both have different epoch times with same availability. Could you show a little more details on how you resolve with a list of clocks?

Here is my sequence:

  1. Click Button1 => Trajectory1 animated and stayed on the map => worked as expected.

  2. Click Button 2 => Trajectory2 animated and stayed on the map and Trajectory1 stayed on the map => worked as expected.

  3. Click Button 1 again => Trajectory1 animated and stayed on the map [But] Trajectory2 disappeared => I want Trajectory2 stayed on the map

Thanks!