Picking works through the Earth
- Dominant language
- JavaScript
- Stars
- 15.7k
- Forks
- 3.9k
- Avg merge
- 4d 6h
- Merged PRs (30d)
- 34
Description
In my app I identify the element at the current cursor position as it moves by the standard:
var pickedObject = scene.pick(movement.endPosition);
if(pickedObject && Cesium.defined(pickedObject) && pickedObject.id)
var element = pickedObject.id;
If the element has name I show this next to the cursor. Elements are loaded via KML and are points and simple line segments. The problem is that Cesium picks line segments on the other side of the globe even if they obviously are not visible.
My current workaround is to get the coordinates of the line and compare it to the coordinate at the cursor position and disqualify it if the distance is large. It works, but the scene.pick() function should probably disqualify such elements. I now crudely just test for existence of entity._polyline._positions since it allows me to solve my problem, but there may be other cases not handled too.
Kjell
Contributor guide
Research direction
Start with the scene.pick(movement.endPosition) entry point and reproduce the behavior using KML-loaded points and line segments on the far side of the globe. Trace how picking handles occluded geometry, including the entity._polyline._positions workaround. Done means hidden line segments are not returned while visible elements remain pickable.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- computer-graphics
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100