In our application we have a mechanism for sharing the initial view of a map. These parameters are saved and can be used to initialise another map, for example:
However, it does not work when you try to share a camera orientation where
orientation.direction.x is negative, i.e. where the camera is pointing upwards above the horizon.
Is there a way to make this work given the camera position information we record? I have made a sandcastle demo where this does not work. This is the view that should be set:
But instead we get this:
There might be some assumptions about the coordinate system in which the orientatation is given. I cannot provide “THE solution”, because that depends on which coordinate system you are using for the
direction/up information. For example, you might have to transform your
direction/up to accomodate for the transforms in
But the following sandcastle might be a small debug helper here:
When you press
"c", then it will print to the console the current camera configuration. You can set the camera configuration that you want, press
"c", and then use the printed code to restore that configuration. Maybe you can compute the desired configuration from your saved state.
Edited for completeness: The Camera snapshot functionality was inspired by cesium/Documentation/Contributors/PerformanceTestingGuide at main · CesiumGS/cesium · GitHub
Thanks very much for your help,
it turns out we are not reading the camera parameters correctly from Cesium in the rare case that the camera is facing upwards above the horizon. Thanks again!