CesiumGS / CesiumGS/cesium

viewer.flyTo and viewer.zoomTo give different results in 2D and CV

Open
#2,473 3 comments 0 reactions 0 assignees View on GitHub
category - 2d / columbus view category - camera priority - high type - bug
Dominant language
JavaScript
Stars
15.7k
Forks
3.9k
Avg merge
4d 6h
Merged PRs (30d)
34

Description

`flyTo` always orients north, but `zoomTo` applies the specified heading. The doc seems to indicate this is by design (at least for 2D). But it also happens for CV. Why do it at all? I think `flyTo` should take the heading into account, just like `zoomTo` does.

While the below example uses the `viewer` commands, the actual behavior is defined in the `camera.flyToBoundingSphere` method.

``` javascript
var viewer = new Cesium.Viewer('cesiumContainer', { sceneMode : Cesium.SceneMode.SCENE2D });

var redRectangle = viewer.entities.add({
name : 'Red translucent rectangle with outline',
rectangle : {
coordinates : Cesium.Rectangle.fromDegrees(-110.0, 20.0, -80.0, 25.0),
material : Cesium.Color.RED.withAlpha(0.5),
outline : true,
outlineColor : Cesium.Color.RED
}
});

Sandcastle.addToolbarButton('zoomTo', function() {
viewer.zoomTo(redRectangle, new Cesium.HeadingPitchRange(Math.PI / 2, -Math.PI / 4, 4000000));
});

Sandcastle.addToolbarButton('flyTo', function() {
viewer.flyTo(redRectangle, {
offset : new Cesium.HeadingPitchRange(Math.PI / 2, -Math.PI / 4, 4000000)
});
});
```

Contributor guide

Open the contributing guide

Research direction

Start with the provided viewer example and inspect the camera.flyToBoundingSphere method, comparing its behavior with zoomTo in 2D and CV. Done means the intended heading behavior is established and flyTo no longer gives a conflicting orientation where the issue expects it to match zoomTo.

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
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.