# About CesiumFlyToController Scripts

**URL:** <https://community.cesium.com/t/about-cesiumflytocontroller-scripts/32231>\
**Category:** Cesium for Unity\
**Created:** [May 17, 2024, 7:18am UTC](https://community.cesium.com/t/about-cesiumflytocontroller-scripts/32231 "2024-05-17T07:18:34Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jh007](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/jh007/32/12437_2.png) [@jh007](https://community.cesium.com/u/jh007)\
**Post date:** [May 17, 2024, 7:18am UTC](https://community.cesium.com/t/about-cesiumflytocontroller-scripts/32231/1 "2024-05-17T07:18:34Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![janine](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/janine/32/5135_2.png) [@janine](https://community.cesium.com/u/janine)\
**Post date:** [May 21, 2024, 2:28pm UTC](https://community.cesium.com/t/about-cesiumflytocontroller-scripts/32231/2 "2024-05-21T14:28:33Z")

</div>

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` and `EarthCenteredEarthFixedToLongitudeLatitudeHeight` on `CesiumWgs84Ellipsoid`
- `TransformEarthCenteredEarthFixedPositionToUnity` and `TransformUnityPositionToEarthCenteredEarthFixed` on `CesiumGeoreference`.

I hope this gives you a good starting point!

---

<div class="post-metadata">

**Author:** ![janine](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/janine/32/5135_2.png) [@janine](https://community.cesium.com/u/janine)\
**Post date:** [May 21, 2024, 2:37pm UTC](https://community.cesium.com/t/about-cesiumflytocontroller-scripts/32231/3 "2024-05-21T14:37:11Z")

</div>

I also see that Kevin gave a more detailed solution here 😄

> [@About CesiumMetadata](https://community.cesium.com/t/about-cesiummetadata/32134/5):
>
> In the future, it’s probably best to start a new thread when you’re asking a new question. There’s nothing built-in to do what you describe, but you can implement it yourself. But first you need to be clear about exactly where you want the camera to look at your target from. If you really don’t care about that, the easiest thing by far is to have the camera be directly above the target and looking straight down. To do that, call FlyToLocationLongitudeLatitudeHeight with the exact longitude and …
