Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Camera flight path in Columbus View ends at wrong destination #802

Closed
hpinkos opened this issue May 28, 2013 · 2 comments
Closed

Camera flight path in Columbus View ends at wrong destination #802

hpinkos opened this issue May 28, 2013 · 2 comments
Assignees

Comments

@hpinkos
Copy link
Contributor

hpinkos commented May 28, 2013

In Columbus view, if the camera is zoomed out further than the default camera position it doesn't fly to the default camera position if it is given as the destination. The position at the end of the flight remains further zoomed out than the default.

Sandcastle example:

require([
    'Cesium', 'dijit/form/Button'
], function(
    Cesium, Button) {
    "use strict";
    var ellipsoid = Cesium.Ellipsoid.WGS84;

    function fly() {
        //move camera to position further than default
        widget.scene.getCamera().position = new Cesium.Cartesian3(0, -38370635.91011722, 38404680.99332635);

        var maxRadii = ellipsoid.getMaximumRadius();
        //default position
        var position = new Cesium.Cartesian3(0.0, -1.0, 1.0).normalize().multiplyByScalar(5.0 * maxRadii);
        var direction = Cesium.Cartesian3.ZERO.subtract(position).normalize();
        var right = direction.cross(Cesium.Cartesian3.UNIT_Z);
        var up = right.cross(direction);
    
        var description = {
            destination: position,
            up: up,
            direction: direction
        };
    
        var flight = Cesium.CameraFlightPath.createAnimation(widget.scene.getFrameState(), description);
        widget.scene.getAnimations().add(flight);
    }
    
    function createButtons(scene) {
        new Button({
            label : "Zoom out, then fly to default position",
            onClick : function() {
                fly(scene);
            }
        }).placeAt('toolbar');
    }

    var widget = new Cesium.CesiumWidget('cesiumContainer');
    var transitioner = new Cesium.SceneTransitioner(widget.scene, ellipsoid);
    transitioner.morphToColumbusView();
    createButtons(widget.scene);
    Sandcastle.finishedLoading();
});
@emackey
Copy link
Contributor

emackey commented May 29, 2013

Discovered while implementing #803.

@pjcozzi pjcozzi mentioned this issue Apr 8, 2014
19 tasks
@bagnell
Copy link
Contributor

bagnell commented Jun 22, 2015

Updated code sample:

var viewer = new Cesium.Viewer('cesiumContainer', { sceneMode : Cesium.SceneMode.COLUMBUS_VIEW });
var scene = viewer.scene;

function fly() {
    var maxRadii = scene.globe.ellipsoid.maximumRadius;
    var position = new Cesium.Cartesian3(0.0, -1.0, 1.0);
    Cesium.Cartesian3.multiplyByScalar(Cesium.Cartesian3.normalize(position, position), 5.0 * maxRadii, position);
    var pitch = -Math.acos(Cesium.Cartesian3.normalize(position, new Cesium.Cartesian3()).z);

    scene.camera.flyTo({
        destination : position,
        orientation : {
            heading : 0.0,
            pitch : pitch,
            roll : 0.0
        },
        convert : false
    });
}

Sandcastle.addToolbarButton('Fly', function() {fly();});

Zoom out when loaded, then click the Fly button.

@bagnell bagnell mentioned this issue Jun 22, 2015
4 tasks
@pjcozzi pjcozzi closed this as completed Jun 30, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants