Cesium: Drill picking polygons causes browser to hang

Created on 8 Nov 2017  路  7Comments  路  Source: CesiumGS/cesium

After upgrading from 1.38 to 1.39, drill picking certain polygons causes the browser to hang in an infinite loop at this spot in the code.

After quite a bit of debugging, I discovered that this happens on polygons that are missing a height attribute, even though the API says it's an optional property. To fix the issue in 1.39 apps, you can explicitly set the height of all polygons to 0.0 (the default). This isn't really a true workaround though, as your polygon will no longer conform to the terrain as it did when you completely omitted the property.

For example, drill-picking the polygon in this Sandcastle example will result in the browser hanging. Add in height: 0.0 and the drill picker will work again (albeit underground if you have terrain enabled).

var viewer = new Cesium.Viewer('cesiumContainer');

var wyoming = viewer.entities.add({
  name : 'Wyoming',
  show: true,
  polygon : {
    hierarchy : Cesium.Cartesian3.fromDegreesArray([
                              -109.080842,45.002073,
                              -105.91517,45.002073,
                              -104.058488,44.996596,
                              -104.053011,43.002989,
                              -104.053011,41.003906,
                              -105.728954,40.998429,
                              -107.919731,41.003906,
                              -109.04798,40.998429,
                              -111.047063,40.998429,
                              -111.047063,42.000709,
                              -111.047063,44.476286,
                              -111.05254,45.002073]),
    material : Cesium.Color.RED.withAlpha(0.5)
  }
});

viewer.screenSpaceEventHandler.setInputAction(function (movement) {
    var picks = viewer.scene.drillPick(movement.position);
    if (Cesium.defined(picks)) {
        console.log(picks.length);
    }
}, Cesium.ScreenSpaceEventType.LEFT_CLICK);

viewer.zoomTo(wyoming);

EDIT: This applies to other primitives too -- not just polygons.

category - picking priority - next release type - bug

Most helpful comment

@pjcozzi The git bisect result is 8e7b0a6ca479400a747b1dd8173b65a1d00cbe22.

All 7 comments

Thanks for reporting this @jburr-nc!

@bagnell was there a change made last release for picking ground primitives?

@jburr-nc do you happen to have any bandwidth to git bisect to try to narrow down the commit?

Cesium had a hang here once before: #4783 / #4784

@pjcozzi The git bisect result is 8e7b0a6ca479400a747b1dd8173b65a1d00cbe22.

Good eye, thanks @jburr-nc!

@bagnell please look at this for the next release.

@jburr-nc it may be a week or two before we can get to this so feel free to dig even farther in the meantime if you want 馃槈

@bagnell Will you be able to look at this for 1.40?

@bagnell reminder to look at this. We should really try to fix this before the release goes out on Friday

@jburr-nc thanks again for the report. This was fixed in #6017 and will be in the Cesium 1.40 release tomorrow.

Was this page helpful?
0 / 5 - 0 ratings