Using computeIcrfToFixedMatrix breaks panning and 2D view

64 views
Skip to first unread message

Juan Luis Cano

unread,
Oct 22, 2019, 6:44:48 AM10/22/19
to cesium-dev
1. A concise explanation of the problem you're experiencing.

I am using using this function to set a inertial view:

// To have an inertial (ICRF) view
function icrf(scene, time) {
    var icrfToFixed = Cesium.Transforms.computeIcrfToFixedMatrix(time);
    if (Cesium.defined(icrfToFixed)) {
        var camera = viewer.camera;
        var offset = Cesium.Cartesian3.clone(camera.position);
        var transform = Cesium.Matrix4.fromRotationTranslation(icrfToFixed);
        camera.lookAtTransform(transform, offset);
    }
}
viewer.scene.postUpdate.addEventListener(icrf);


However, this has two bad effects:

* When zooming in, panning is more sensitive and I end up moving too much.
* When switching to 2D View, I get an error saying:

An error occurred while rendering.  Rendering has stopped.
undefined
DeveloperError: lookAtTransform is not supported while morphing.
DeveloperError@https://sandcastle.cesium.com/CesiumUnminified/Cesium.js:82:23
Camera.prototype.lookAtTransform@https://sandcastle.cesium.com/CesiumUnminified/Cesium.js:183729:23
icrf@https://sandcastle.cesium.com/templates/bucket.html line 602 > scriptElement:18:16
Event.prototype.raiseEvent@https://sandcastle.cesium.com/CesiumUnminified/Cesium.js:13654:34
Scene.prototype.render@https://sandcastle.cesium.com/CesiumUnminified/Cesium.js:238770:30
CesiumWidget.prototype.render@https://sandcastle.cesium.com/CesiumUnminified/Cesium.js:251493:29
render@https://sandcastle.cesium.com/CesiumUnminified/Cesium.js:250830:36


2. A minimal code example. If you've found a bug, this helps us reproduce and repair it.


3. Context. Why do you need to do this? We might know a better way to accomplish your goal.

I prefer to be able to have an inertial view.

4. The Cesium version you're using, your operating system and browser.

Cesium 1.62 (Cesium Sandcastle), Linux Mint 19.2, Firefox 69.0.3.

Omar Shehata

unread,
Oct 27, 2019, 7:29:55 PM10/27/19
to cesium-dev
I think you may need to detect and disable the inertial frame logic when the camera is morphing and/or when it's in 2D view. You can listen to the morph event here:


And detect whether it's in 2D/3D here:

Reply all
Reply to author
Forward
0 new messages