Open
Description
A tracked entity does not get tracked while another data source is loading. Is this a bug or intentional?
The area of the code that is suspicious is Viewer._onTick
and DataSourceDisplay.getBoundingSphere
. An entity is only updated if its bounding sphere is DONE
, but getBoundingSphere
returns PENDING
if any data sources are loading (_ready
will be false). This causes the entity to not get updated and the camera doesn't have a new position to track.
A possible fix would be to check only the ready state of the data source containing the tracked entity. But someone more familiar with the code might have a better idea.
var viewer = new Cesium.Viewer('cesiumContainer', {
shouldAnimate : true
});
viewer.allowDataSourcesToSuspendAnimation = false;
var truckPromise = viewer.dataSources.add(Cesium.CzmlDataSource.load('../../SampleData/MultipartVehicle_part1.czml'));
truckPromise.then(function(czmlDataSource) {
viewer.trackedEntity = czmlDataSource.entities.getById('Vehicle');
});
window.setTimeout(function() {
viewer.dataSources.add(Cesium.GeoJsonDataSource.load('../../SampleData/ne_10m_us_states.topojson'));
}, 1000);