camera heading = roll?

Hello,
I am not sure if this is a bug or a feature.
I try to manipulate the camera's heading, pitch and roll. And it seems that the heading does the same rotation as the roll.

So using this:
viewer.camera.setView({
    orientation : {
        heading : h + 0.5,
        pitch : p,
        roll : r
    }
});

has the same results like this:

viewer.camera.setView({
    orientation : {
        heading : h,
        pitch : p,
        roll : r + 0.5
    }
});

Below code to reproduce this in the Sandcastle. You will first see the rotation using heading, then it will reset the camera's position and do the same rotation using roll. I think it should look different. Could you help me understand this? Thanks :slight_smile:

var viewer = new Cesium.Viewer('cesiumContainer');
var h = viewer.camera.heading;
var p = viewer.camera.pitch;
var r = viewer.camera.roll;

var value = 0.5;

console.log(h);
console.log(p);
console.log(r);

var b = function() {
    viewer.camera.setView({
        destination : Cesium.Cartesian3.fromDegrees(13.305, 52.528, 3000000),
        orientation : {
            heading : h,
            pitch : p,
            roll : r
        }
    });

    viewer.camera.flyTo({
        destination : Cesium.Cartesian3.fromDegrees(13.305, 52.528, 3000000),
        orientation : {
            heading : h,
            pitch : p,
            roll : r + value
        },
    });
};

viewer.camera.setView({
    destination : Cesium.Cartesian3.fromDegrees(13.305, 52.528, 3000000),
    orientation : {
        heading : h,
        pitch : p,
        roll : r
    }
});

viewer.camera.flyTo({
    destination : Cesium.Cartesian3.fromDegrees(13.305, 52.528, 3000000),
    orientation : {
        heading : h + value,
        pitch : p,
        roll : r
    },
    complete : b
});

Hello,

I believe this is expected. This looks like the result of gimbal lock. Because the camera is pointed straight down, the heading and roll rotations are the same.

Best,

Hannah

Hallo Hannah,
thanks for your response.

You are right. I figured out that setting pitch to 0 solves this problem. But obviously changes the rotation I wanted.
I will try to use direction vector and up vector instead.