When using the camera flyToBoundingSphere method, it seems that the camera pitch is slightly updated even if it was provided as is in the offset argument.
2. A minimal code example. If you've found a bug, this helps us reproduce and repair it.
Clicking on "Fly to entity" multiple times will move the camera. Only camera pitch is modified, camera heading remains exactly the same.
3. Context. Why do you need to do this? We might know a better way to accomplish your goal.
I would like to fly to a target (given its coordinates), without modifying the current camera orientation and altitude. We assume that target altitude is less than camera altitude.
4. The Cesium version you're using, your operating system and browser.
Reproduced with Cesium 1.51, on Windows/Fedora/MacOS, Chrome/Safari.
I saw this on the docs before opening this thread, but I was not sure if there was really a difference or not.
That said, would you know if there is a way to calculate the pitch relative to the bounding sphere location from the pitch relative to globe, and vice versa ?
Thank you.
I am sorry for the issue I made on the github, I did not understand well the difference between the frames.
Now it is more clear to me. I succeeded in calculating the good pitch in the target reference frame from the pitch in camera reference frame. Now, I have the desired orientation.
I just have one last problem. I would like to preserve the camera altitude from the old camera position to the new position. I have:
- a direction vector, that provides me the direction of the camera that is necessary to look the target with right orientation.
- the altitude the camera is and should be after the flight.
And I would like to calculate the new coordinates of the camera new position.
I thought about using Intersectiontests class. I could determine the intersection of a ray with target as origin and the negate of camera direction as direction, with an ellipsoid corresponding to the camera altitude.
Do you think this solution would be a good idea? Would you see another way to achieve what I am trying to do?
Let's say camera is initially at a position (longitudei, latitudei, altitudei), and has an orientation (headingi, pitchi, rolli).
I would like the camera to fly to a target (look a it). I would like the camera to keep the same orientation (headingi, pitchi, rolli), and the same altitude. Thus, new camera position must be (longituden, latituden, altitudei) where longituden and latituden must be determined.
Using eastNorthUpToFixedFrame, I am able to calculate a direction vector starting from the target with right direction to preserve the camera orientation. That means that the camera must be on this axis to preserve its initial orientation (headingi, pitchi, rolli).
However, I cannot find the right position (longituden, latituden) on this axis to preserve camera altitude too.
Hope it's clear. I'll try to do another simple sandcastle to illustrate my problem.