Orientation not working as I would expect

I noticed that in the Models Sandcastle, that if I comment out the orientation on line 18, the airplane points down the x-axis with no pitch or roll like I would expect.

If I uncomment that line and set the orientation to the value Cesium.Quaternion.IDENTITY, I expect the same result. However, when I do so, the airplane is then tipped with its nose down and to the left.

Anybody know what I’m getting wrong?

When orientation is not specified, it defaults to east-north-up, not the identity quaternion.

https://github.com/AnalyticalGraphicsInc/cesium/blob/master/Source/DataSources/Entity.js#L576

Thanks, Scott! I assumed that the identity quaternion would also set the model to east-north-up. What is the expected behavior for the identity quaternion?

The orientation CZML property is a unit quaternion that rotates a vector in the model axes to Earth fixed axes. So identity means that the model axes will be the same as Earth fixed.

Maybe my issue is that I don’t understand the Earth-fixed coordinate system. I was thinking that there was a “world” coordinate system that related to the earth via ENU … so in world coordinates, the x-axis is east, y-north, z-up. And I’ve just been guessing that the origin is the center of the earth ellipsoid. To stay sane, I’m assuming that when we spin the earth, it’s actually the earth that spins, and not the camera, such that we don’t have to worry about which direction the camera is facing, etc.

So, then, I expected that an undefined orientation would put the model’s x-axis pointing east (because of ENU, like you mention), but that an identity orientation would do the same.

Are you suggesting that there are three coordinate systems here?

  1. The “world” coordinate system like I mentioned, which is ENU
  2. An earth-fixed coordinate system that stays locked with the earth as it spins such that a point on the globe is always the same (x,y,z) point in that frame
  3. A model coordinate system
    And you’re saying that an undefined orientation places the unit at an identity transform in frame 1, but that an identity orientation places it at an identity transform in frame 2?

If I have that right, that will raise more questions in my head because I’m not quite sure why the earth-fixed coordinate system would have its x-axis pointing down and to the left with regard to the ENU system in that Sandcastle demo.

Close. The world coordinate system is Earth fixed, ECEF. ENU is location dependent, so the transformation changes as objects move.

Wikipedia has a picture showing both ECEF and ENU to visualize how they relate. https://en.wikipedia.org/wiki/Axes_conventions#Ground_reference_frames:_ENU_and_NED

When orientation is identity, the plane points down and to the left because of where it happens to be located. The X axis of the model is aligned with the X axis of Earth fixed, which intersects the surface at 0 lon, 0 lat (atlantic ocean near africa). If you change the lon/lat in the Sandcastle example (e.g. negate longitude) you can see how the orientation still points towards that same axis.

Thanks! That was really helpful.