CesiumGS / cesium

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

Zooming does not track cursor position with `globe: false` #11679

Open jjhembd opened 9 months ago

jjhembd commented 9 months ago

In the current 3D Tiles Next Globe Sandcastle, the Viewer is initialized with globe: false. Zooming with the scroll wheel does not track the cursor position.

https://github.com/CesiumGS/cesium/assets/41167620/c3b3971c-85a1-48c6-a095-66616d433a58

This can be fixed by initializing with a globe, and then setting globe.show = false;. See this updated Sandcastle:

https://github.com/CesiumGS/cesium/assets/41167620/74325b7e-c86a-4f02-bce7-8577917fe46f

This non-tracking behavior also appears to have been introduced to the Google Photorealistic Tiles Sandcastles by https://github.com/CesiumGS/cesium/pull/11542.

syzdev commented 8 months ago

@jjhembd After the globe is hidden, the pick method will not be executed to get the world coordinates. https://github.com/CesiumGS/cesium/blob/31293c147e9e14a32ba3d6e04662198e5874fed4/packages/engine/Source/Scene/ScreenSpaceCameraController.js#L625-L631

The problem was solved by making the following changes:

} else {
  pickedPosition = pickPosition(
    object,
    startPosition,
    scratchPickCartesian
  );
}

But this is obviously not a good solution.

jjspace commented 2 months ago

Reported on the forum. This is important for global tilesets that act as terrain like the Google tileset