CesiumGS / CesiumGS/cesium

Tracked entity not tracked while another data source is loading

Open
#6,556 0 comments 0 reactions 0 assignees View on GitHub
category - data sources type - bug
Dominant language
JavaScript
Stars
15.7k
Forks
3.9k
Avg merge
4d 6h
Merged PRs (30d)
34

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.

[Sandcastle demo](https://cesiumjs.org/Cesium/Apps/Sandcastle/index.html#c=hVLfa9swEP5XhF/sQJCT184NW7MxWjo2SOmTIajSpdEqn4x0iklH//edEpc0HaNGD9LdfT/0yTsVxM7CAEFcCoRBLCHa1Mn7Q60q9eG49EjKIoRyKv60KPiLW5+c+YK2UwTiQlBI0OLL5FOLLR4ZpXLOD18VqZVPgZnu/CrFHnCEWY8sulEuwgHFOHbDRPrpV/CdjcDtkcqcWKQyphptLp87dxKQzitTlVLWvFaq6x3kZv0jObK9CnQPW6sdrPN+LjWDy0l2/FZT0haw2iTU2WClzxQmr9cfbVFQ+gnMNyRLe3Z7Pi0h1y1bfgS62l+zt9FBmVXHsAaLxg8yAt3ZDnyik/h7uf+k8B38TfT4cRAI6/msW6e4jsTPFiX53v9m6DGGl6mYz2azvC2mRRNp72BxNPDZdr0PJFJwFXMSMGdmqB84OSCpY8ywpn4FNcbuhDWXbfHuF2oLoZ2KkTub5NzKPkNbLJqa589g+QoWH3/uIDi1zyPb+eL2WJRSNjUf/0WR9+5BhTeMfwE)

```js
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);
```

Contributor guide

Open the contributing guide

Research direction

Start with Viewer._onTick and DataSourceDisplay.getBoundingSphere, then reproduce the issue using the linked Sandcastle demo and its CZML and GeoJSON loading sequence. Trace why a tracked entity is skipped while another data source is loading; done means the tracked entity and camera continue updating during that load without breaking data-source readiness behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
data-visualization, frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.