Czml Orientation is askew

I'm having a bit of trouble using custom orientation loaded through a czml file.

1. A concise explanation of the problem you're experiencing.

I put some aircraft orientation data (roll, pitch, yaw) in a czml file (as unitQuaternions), and it loads in just fine. However, the orientation of the aircraft itself is askew, so when it should be displayed with the body about parallel to the ground, it is actually displayed tilted to one side. The amount of tilt appears to be determined by position: at the equator the tilt is about 90 degrees, and at the north pole the orientation seems to function as intended.

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

This problem can be easily recreated in the "CZML Model" example on Sandcastle:

I believe that adding the following code to the "czml" variable:

    "orientation" : {
        "unitQuaternion" : [1, 0, 0, 0]

should flip the aircraft model upside-down. However, in the example the aircraft is displayed tilted at about a sixty degree angle.

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

My goal is to have the orientation data I load into the czml file represented on the aircraft model so that turns and rotations are displayed. Is there a way to adjust my data so that it is displayed properly?


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

“orientation” in CZML is a rotation that takes a vector expressed in the “body” axes of the object and transforms it to the Earth fixed axes (ECEF).

You may be expecting something more like a East-North-Up orientation. The rotation between ENU and ECEF is location-dependent, so the values change over time as objects move. In CZML, that rotation would need to be computed when the file is generated.

Wikipedia has a picture showing both ECEF and ENU to visualize how they relate.

Ah, I see. And should I perform this conversion on the data before inserting it into the CZML file, or is there some way to adjust the values after they have been loaded into the Cesium app?

Thanks for the reply!