Hi @MBG,
There’s a lot to unpack here, and it’s a little hard to decide where to start. But maybe it would help to explain a bit about how an object with a CesiumGlobeAnchor interacts with a CesiumGeoreference. It’s possible you already know this, but I think making sure we have this baseline of shared understanding will be useful.
A CesiumGeoreference defines where on the globe the Unity world coordinate system is located. Specifically, the Unity coordinate system’s origin (0,0,0) will be at that location on the globe, and the Unity +X axis will point East, the +Y axis will point up, and the +Z axis will point North.
An object with a CesiumGlobeAnchor (which includes DynamicCamera) is positioned and oriented relative to the globe, not relative to the Unity coordinate system the way normal objects are. Which means that if you change the CesiumGeoreference origin, all globe anchored objects will get a new Unity location and orientation such that their location and orientation relative to the globe is unchanged. If your camera has a CesiumGlobeAnchor, then changing the CesiumGeoreference will have no impact whatsoever on the view of the globe.
When you change the Unity transform
of an object with a CesiumGlobeAnchor, Cesium for Unity will eventually compute a new globe location and orientation from it. I say eventually because Unity does not provide a notification for this, so we have to periodically poll for it in a coroutine. This can sometimes lead to inconsistencies that manifest as weird behavior. As Ashley mentioned, the best thing to do is to call Sync
on the CesiumGlobeAnchor immediately after changing the transform
, which will ensure the globe-relative location and orientation are updated immediately.
Everything I’ve just described is very much by design. If you’re trying to “spin the globe” by changing the CesiumGeoreference, you must use a camera without a CesiumGlobeAnchor.
If I were going to write a Google Earth (or CesiumJS) style camera system for Cesium for Unity, though, I definitely would not try to do it by manipulating the CesiumGeoreference. Instead, I would position and orient the camera in globe-fixed ECEF coordinates based on input, and set the new values on the camera’s CesiumGlobeAnchor. I would let the CesiumGeoreference follow the camera via the CesiumOriginShift component, because this will give us the best precision.
Just in case it’s helpful and you haven’t already seen it, there’s more detail about globe anchoring in this tutorial: