I have a question about the CesiumFlyToController script. Currently, the implemented flight involves the camera flying to a certain position and setting the rotation of the X and Y axes. However, I want to focus on a specific latitude and longitude. That is, when flying over, the object at the focused latitude and longitude is exactly in the center of the screen, and the distance from the camera is set as a parameter: distance . How can this be implemented?
Hi @jh007,
I don’t think we’ve ever attempted to implement that! But, it sounds like you might need to compute the offset between your desired longitude / latitude, and the actual long / lat that the camera will fly to.
You could start with the desired long / lat, convert it to a Unity position, then subtract your desired offset from that Unity distance. Then, you can re-convert that final Unity position to long/lat. For the conversions, you could use:
LongitudeLatitudeHeightToEarthCenteredEarthFixed
andEarthCenteredEarthFixedToLongitudeLatitudeHeight
onCesiumWgs84Ellipsoid
TransformEarthCenteredEarthFixedPositionToUnity
andTransformUnityPositionToEarthCenteredEarthFixed
onCesiumGeoreference
.
I hope this gives you a good starting point!
I also see that Kevin gave a more detailed solution here
1 Like