Animating a entity - SampledPositionProperty

We have an application that is using cesium as the view of a simulator. The application receives messages that tell the view to update the positions of objects that we have represented by a group of entities. Currently, we are animating the entity group via the preRender event, but I was going to attempt to use the one of the PositionProperties. One of the issues is that we do not get a message that an object is moving from position A to position B. We just get a message saying that an object has moved to position B. We are currently keeping the view slightly behind the simulation by moving the object over a second interval from A to B. The position properties and callbacks seem really good at setting up animations that are closely bound to a time interval, so I’m not really sure if I should be changing our approach or not. Basically, when we get a message that an object has moved that might be one of several updates to that object or it could be last update for the simulation. What would be the approach to updating the unit dynamically? Would I set up a position property while animating and then set the final position to a Cartesian3?



Hi Scott,

Would I set up a position property while animating and then set the final position to a Cartesian3?

That sounds like a good approach. That way the entity won’t keep updating after the animation is over.


I’m not sure what you mean by “set up” Are these object constantly moving? Or are the moving/stopping/moving again? If they are constantly moving, just use SampledPositionProperty and add samples when new data comes in. If you want the sample to interpolate forward/backward or hold position while you’re waiting for data, those are options on the SampledPositionProperty.

If you have a case where you are starting, moving, stopping, starting again, then you can use a CompositePositionProperty with SampledPositionProperty for times of movement and ConstantPositionProperty for when it’s not.

We have two types of position changes that we can get for an object/unit(2525B).

One is an absolute change, and there is no information about how the object got from it’s old position to the new position or if that object will ever move again. I was thinking of using a snap-to(quartOut tweenjs) move for this position change. That way a user would lose perspective of the unit that was moved. There could be thousands of the units, so watching them all just jump from position to position is not the best.

Another would be that an object has been given an order to move to a new location. This could be a multi segmented route or just an order to move to a new single position. By ‘set up’, this is the case that I was referring to. I thought I could create the animation much the way you were describing, I just wasn’t sure about changing out those “Properties”. It is possible that a unit could be destroyed or it’s current path is blocked after receiving the order. In this case, I would need to halt the animation when the simulation alerts the view with that information. If the unit is destroyed then it’s movements are probably done for a while, but if it route was blocked then it would likely wait for a back up route to be determined.