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.92k stars 3.48k forks source link

Picking is selecting the wrong feature #12145

Open eric-g-97477 opened 2 months ago

eric-g-97477 commented 2 months ago

What happened?

I clicked on a feature on the globe and it selected the furthest object found instead of the nearest.

I expected the nearest object to be selected.

Reproduction steps

  1. Use the provided sandcastle
  2. Click somewhere in the area outlined by the red square

image

  1. What shows up is:

image

  1. If I click most other places in that same green polygon, I get the correct answer which is:

image

Rotating the globe so that IDN polygon is no longer beneath the CAN polygon results in the correct behavior because only a single polygon can be found at the click location.

What I did notice is that if I set clampToGround: false, then the picking works correctly. However, it would be useful to me to be able to have picking work correctly with clampToGround: true.

Sandcastle example

https://sandcastle.cesium.com/#c=vVVbb9s2FP4rhF+sAAotSrIluW6wwF3bDF0bIENf4j4w0rFLjCIFknLgDfnvI0XJtybNHoZBgCSe79zPR7KUQhu0BmpaBRq9RX+vBEJm18Acjd978VJyDqVhUoxD5OBBfY7u3bIzQWg1YtVqNLffaDUKB5lz5aW9tyOsUbIBZRhop9G76RxpGXujm3d7/R5IBuDzOfK5rUGx0uPJLDrBBa37PG5EJQVoRk/wEoQB5TTuCckwKUiWR1ERJUkcTUN0meBplidRlJE0LeKsyL9526d9NRuQNRi1O6vl0IBbyXcbKU7DSqkqJqjxPbgfEHT8axckJTgiRWozIQTHUT77Fr6gMMNxlk7P4CLFWUay19BXne8VDvj+d+iI+/i2/MAM8t8xY3n9AjOW1z9nBonTF5ixpIJWL9LisohxlhdFUuR5lGSE2GZOcZxM84jMilmWZUn6/5LichrjJE7sWOx8ZtnsfGwHPE9wkszIOd7NNYqzf6HwWoQBf40X7mUFT2/cz0qU3fnTCg3uiIHqPePcnjdS2aNIwCNa2o3a1rgTBVGIbDohivwrvbBO3OOdSF2fGn1pQNwZBWB+p81NTTegdrdKblkFKuiG0SqO7Dn33ZhGzycTig3jgC31rD9nV9MGS7WZjG3CPpgPtWXwCGcpfu1kgaOMWy+lMJQJx53QT/6BavhEd6Dmg0mfUyfEayXrIbtrvRNlYAu6CE8sb1n5p7NfU66hgyy/SlmdykoFFTMun0YqM0ei5TzsKkCHEnzDf91afn+kouLn5dxZL7Z9DS3hWCnwpeOSii3VF/0UqcsXrVvR3RKIS1r9pqUILnzlPqKCjQXvZKtKOI31AaRTf0cN9XAwNo9yPHg/ONAtN9aUPlJ26g+7kMFwL4WHrba2fJo/x689j2uqbE/v2F/2xov20pLTuvlDflCyFdUcGdVCjz0d0up7Ue3z1phWVXCcmFN+cl0/9OTNKBwttNlxuBqi/cJqNyrHxwDjiYG64W73Tx5aO3CDS923GqHF5Nh0UbEtYtXbZ1jnStDaIms7flfeanS1mFj9H0xdakxsvmxBcbpzat/J1ScvxBgvJnb5vKWRkj9Qdeb5Hw

Environment

Browser: Safari 17.6 and Chrome 127.0.6533.120 CesiumJS Version: 1.120 Operating System: macOS 14.6.1

Patsnoop commented 2 months ago

Hey. I would like to work on this. Thanks!

eric-g-97477 commented 1 month ago

The related conversation surrounding this bug is at https://community.cesium.com/t/picking-is-selecting-the-wrong-feature/34676