Hello I am working on visualize data that come from socket. I want to move entity smoothly to new positions. I tried to use Cesium.SampledPositionProperty and add samples when data came from socket. When I did this entity moves smoothly but lags behind the actual position over time. How can I fix this issue ?
It sounds like you may need to use the Clock to update the current simulation time.
If you’re doing that and still seeing an issue, it would help if you could share a Sandcastle example with your code. That would help us troubleshoot.
Thanks!
Gabby
Hi @Gabby_Getz thanks for your reply.
I use Cesium.JulianDate.now() when adding instance to PositionProperty.
As data comes from the socket
positionProperty.addSample(Cesium.JulianDate.now(), position); By doing this, I aim for the entity to move smoothly between locations. But when I do it this way, the entity is created late and starts from the first sample in positionProperty. That’s why it always lags behind the last position in the socket. Instead, when I add positionProperty.addSample(viewer.clock.currentTime, position) using viewer.clock.currentTime, the entity is created immediately and moves in line with the last position in the socket, but in this case, it moves by jumping to the new position instead of fluent transition.
It could be possible to use a CallbackProperty in addition to the SampledPositionProperty to ensure for smooth updates.
If you could share a Sandcastle example with your code, that could help us troubleshoot what you are seeing.
The base logic on project can be found in sandcastle example. I add samples with time when data came from socket. Logically, the time difference between the last sample and the location of the vehicle should always be equal, but as far as I can see, this difference is around 3-4 seconds when the first data comes from the socket, and can increase to 60-70 seconds until the last data comes from the socket. What could be the reason for the wide difference in seconds?
Thanks for providing solution. It help me a lot.