CesiumGS / cesium

An open-source JavaScript library for world-class 3D globes and maps :earth_americas:
https://cesium.com/cesiumjs/
Apache License 2.0
13.03k stars 3.51k forks source link

Change scene.pickPosition to globe.pick on Sandcastle #7261

Closed OmarShehata closed 1 year ago

OmarShehata commented 6 years ago

It came up on the forum that setting baseLayerPicker: false makes scene.pickPosition report an incorrect position.

I was about to open a bug for this since I don't think turning off the widget should change this behavior (right?) when I tried @hpinkos 's suggestion here to use globe.pick instead, and that works pretty well.

You can test this in this Sandcastle by turning off the widget and trying to draw:

https://cesiumjs.org/Cesium/Build/Apps/Sandcastle/?src=Drawing%20on%20Terrain.html

This issue is to at least change the Sandcastle to use globe.pick if that's a more stable function. Should there be a separate issue for the baseLayerPicker or should I just make a comment in the scene.pickPosition returns incorrect position issue?

hpinkos commented 6 years ago

For turning off the widget, see #6991 BaseLayerPicker secretly sets globe.depthTestAgainstTerrain = true. pickPosition only works decently well when it's set to true, so when the widget isn't included depthTestAgainstTerrain is false and pickPosition stops working.

I agree that the example would be better using globe.pick instead for picking terrain. I would only recommend using pickPosition for picking the exact position on a 3D tiles or glTF model.

ggetz commented 1 year ago

Closing this as the root issue is https://github.com/CesiumGS/cesium/issues/4368.