camera.flyTo goes underground
See original GitHub issuecamera.flyTo
ends up underground in a location where the globe does not have a height.
The expected result is that that camera flys to 100 meters above the ground at the given location and the vehicle is visible on the surface of the ground.
Browser: Chrome 103.0.5060.114
Operating System: MacOS
Issue Analytics
- State:
- Created a year ago
- Comments:11 (11 by maintainers)
Top Results From Across the Web
Camera go underground after camera.flyto() complete
I use camera.flyTo(), and then tilt the camera, the view goes underground. (even in the sandcastle Camera example, I met the same problem)....
Read more >When the camera flies into the ground, it will automatically fly ...
I set a camera to fly to the ground, after a few seconds after the camera will ... is loaded in or the...
Read more >KML viewer.flyTo placemark goes underground #4327 - GitHub
Using viewer.flyTo for a pin created by this KML file results in the camera going under ground. var viewer = new Cesium.
Read more >This tiny camera can show the world from a bug's point of view
Steerable arm helps save energy while capturing panoramic views Read the research: https://scim.ag/3fVOotOCreditproducerMeagan ...
Read more >ALL 80 Lumenspar Locations (SUPER DETAILED) - YouTube
ALL 80 Lumenspar Locations (SUPER DETAILED) | The Chasm: Underground Mines |【Genshin Impact】 · Chapters. View all · Chapters · Description.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@j9liu is going to open a PR with the fix mentioned above so that
ModelExperimental
behaves likeModel
, but there’s still a separate underlying issue.Here’s some of my notes on this issue so far.
How does <tt>HeightReference</tt> work with <tt>ModelGraphics</tt>?
Entity
is created, theModelGraphics
object can be assigned aHeightReference
.DataSourceDisplay
calls the update function of eachVisualizer
, includingModelVisualizer
. This is where theModel
/ModelExperimental
object is initialized and all relevant properties are propagated, includingheightReference
. TheheightRefence
is not passed into the constructor, instead, the public setter for the value is used.ModelExperimental.update
:updateClamping
_heightDirty
, which can be set by any of the following:heightReference
public setter is usedscene.terrainProviderChanged
event is raisedgetUpdateHeightCallback
is calledgetUpdateHeightCallback
is registered with theQuadtreePrimitive.updateHeight
function to be called (from theendFrame
function ofQuadtreePrimitive
) whenever a new tile is rendered that contains the cartographic position of the model. The value returned fromupdateHeight
is a function to be called to remove this callback from being called wheneverupdateHeight
is called.height
for the cartographic position of the model, which is obtained fromglobe.getHeight
.getUpdateHeightCallback
is called.model._clampedModelMatrix
is updated with the new position.model._heightDirty
flag is set.updateBoundingSphereAndScale
updates the bounding sphere frommodel._clampedModelMatrix
.updateReferenceMatrices
updates all relevant matrices frommodel._clampedModelMatrix
.How does
flyTo
work with anEntity
withModelGraphics
withHeightReference
?zoomToOrFly
function cancels any existing zoom and assigns a newViewer._zoomTarget
.Viewer._postRender
function:_zoomTarget
is an array of entities, loop through all the entities.DataSourceDisplay.getBoundingSphere
for the entity and see if the state isBoundingSphereState.DONE
. If it isBoundingSphereState.PENDING
, the function returns.camera.flyToBoundingSphere
.Why does
flyTo
go under the ground when called for anEntity
withModelGraphics
withHeightReference
?If the camera is far away, the bounding sphere computed for
Model
/ModelExperimental
will be based on the lower LOD terrain tile. This initial position computed will be enough to complete theupdateZoomTarget
function called inViewer._postRender
. Essentially, there’s no correction for the recomputation of the bounding sphere based on the higher LOD tiles loading during the flight of the camera to the initial position.Potential Fix 1: Store the current target bounding spheres that are being flown to and in the per-tick update of Viewer, check if they have been updated. If so, update the bounding sphere the camera is flying to. The issue here is that there needs to be some sort of termination condition i.e. at some distance, we’re close enough stop receiving height update and finish the promise. I tried implementing this one and it seems kinda clunky. Having to cancel and begin a new camera flight doesn’t look very nice.
Potential Fix 2: Compute an estimate of the bounding sphere in the model that uses
sampleHeightMostDetailed
and use this as the initial bounding sphere for theflyTo
function. This is the one I am currently pursuing. The code changes here are so far limited toModelVisualizer
.