Given an Entity, I'm trying to figure out if at a particular moment/frame, if one of the entities is viewable on the screen.
The closest I could find was Entity.isVisible, but it seems to just tally the explicit show properties. It returns true even if...
- Transparency is 0%
- The Entity is out of frame (eg. above the viewable area)
- The Entity is occluded (eg. on the other side of the Earth)
I also can't find any functions to convert the entity position to viewport coordinates to test if it is at least within the camera view cone.
I had one idea to measure the distance between the entity and the camera kinda like this Cesium.Cartesian3.distance(this.viewer.selectedEntity.position.getValue(Cesium.JulianDate.now()), this.viewer.camera.position); But obviously the acceptable distance needs to be based on the camera height, FOV and if the camera is even looking in that direction. I haven't yet been able to get the math to work for this solution.
How can I tell if an Entity is currently visible to the user?