Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dynamic boxes don't track correctly #5164

Open
emackey opened this issue Mar 28, 2017 · 7 comments
Open

Dynamic boxes don't track correctly #5164

emackey opened this issue Mar 28, 2017 · 7 comments

Comments

@emackey
Copy link
Contributor

emackey commented Mar 28, 2017

Noticed during testing of #5133.

Boxes with dynamic geometry don't track correctly when the clock is animating. You can pause the clock, and track such a box with the camera, and that works fine. But when the clock moves, the box flies away from the camera.

Note that boxes are believed to be representative of almost all "dynamic" geometry with the exception of ellipsoids in 3D mode. Ellipsoids in 3D mode are actually not "dynamic" in the normal Cesium sense of rebuilding vertex data every frame, instead they modify their matrices for better performance. Boxes could be made to do that too, but this issue is specifically to track geometry that must be rebuilt every frame, and dynamic boxes are currently a good test case for that.

This is a very old bug, dating back at least to the introduction of boxes themselves. The most recent version of Cesium that doesn't show this bug is 1.22, because there is no dynamic box:

Working, but no box: Cesium 1.22 test

Box present, tracking broken: Cesium 1.23 test

More recent, same behavior: Cesium 1.31 test

@mc-allen
Copy link

I am hitting this in a use case of tracking a moving object with a "keepout box" around it. An ellipsoid works fine, but if I use a box the tracking doesn't work and the camera is pointed at the original entity position at T0.

I would appreciate prioritizing this issue.

@hpinkos
Copy link
Contributor

hpinkos commented Oct 14, 2019

Related to #6631

DynamicEllipsoidGeometryUpdater was optimized so that it only recreates the EllipsoidGeometry when certain properties that require a recreation change. DynamicBoxGeometryUpdater could be optimized similarly. @mc-allen if you open a pull request, we would be happy to review it! I'm not sure how soon someone from our team would be able to look into this. Thanks

@hpinkos
Copy link
Contributor

hpinkos commented Apr 28, 2020

Also reported by @461255824 in #8800

See test case here: #8800 (comment)

@461255824
Copy link

thank you! the project is amazing

@OmarShehata
Copy link
Contributor

Reported again on the forum: https://community.cesium.com/t/problem-of-tracking-entity-with-dynamic-polygon-hierarchy/9809

When I have a tracked entity without dynamic polygon hierarchy, it runs correctly.

Once I added the dynamic polygon hierarchy in the way of callback property, the tracking camera seemed to be still at the start moment that never tracking the entity.
Sandcastle

@dzungpng
Copy link
Contributor

dzungpng commented May 3, 2021

A potential fix is to change the second argument in getBoundingSphere in Viewer.js (

) to true, as mentioned in #9455:

Viewer.prototype._onTick = function (clock) {
  var time = clock.currentTime;

  var isUpdated = this._dataSourceDisplay.update(time);
  if (this._allowDataSourcesToSuspendAnimation) {
    this._clockViewModel.canAnimate = isUpdated;
  }

  var entityView = this._entityView;
  if (defined(entityView)) {
    var trackedEntity = this._trackedEntity;
    var trackedState = this._dataSourceDisplay.getBoundingSphere(
      trackedEntity,
      // false,
      true, //switch false to true
      boundingSphereScratch
    );
    if (trackedState === BoundingSphereState.DONE) {
      entityView.update(time, boundingSphereScratch);
    }
  }
...

This sets allowPartial to true. Definition for allowPartial:
pending bounding spheres are ignored and an answer will be returned from the currently available data

This may not be the best fix since it could incorrectly return when the data is not ready yet.

More here:

DataSourceDisplay.prototype.getBoundingSphere = function (

@ggetz
Copy link
Contributor

ggetz commented Jul 28, 2022

Reported in #10517

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants