# programmatically tiltup/tiltdown

**URL:** <https://community.cesium.com/t/programmatically-tiltup-tiltdown/7086>\
**Category:** CesiumJS\
**Created:** [June 26, 2018, 2:01pm UTC](https://community.cesium.com/t/programmatically-tiltup-tiltdown/7086 "2018-06-26T14:01:55Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Reaky](https://avatars.discourse-cdn.com/v4/letter/r/f14d63/32.png) [@Reaky](https://community.cesium.com/u/Reaky)\
**Post date:** [June 26, 2018, 2:01pm UTC](https://community.cesium.com/t/programmatically-tiltup-tiltdown/7086/1 "2018-06-26T14:01:55Z")

</div>

I want to do the tiltup / tiltdown operation programmatically by pressing the mouse scroll button. I read it for camera documentation but I could not make any necessary calculations. Could you share sample code?

example :

> **[dmeo](https://ibb.co/XSm2rN6)**
>
> Image dmeo hosted in ImgBB

---

<div class="post-metadata">

**Author:** ![Gabby\_Getz](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/gabby_getz/32/7838_2.png) [@Gabby\_Getz](https://community.cesium.com/u/Gabby_Getz)\
**Post date:** [June 27, 2018, 2:18pm UTC](https://community.cesium.com/t/programmatically-tiltup-tiltdown/7086/2 "2018-06-27T14:18:08Z")

</div>

Hi there,

Set the **[ScreenSpaceCameraController.tiltEventTypes](https://cesiumjs.org/Cesium/Build/Documentation/ScreenSpaceCameraController.html?classFilter=camera#tiltEventTypes)** to the **CameraEventType** you want, in this case **[CameraEventType.WHEEL](https://cesiumjs.org/Cesium/Build/Documentation/CameraEventType.html#.WHEEL)**.

Thanks,

Gabby

---

<div class="post-metadata">

**Author:** ![Reaky](https://avatars.discourse-cdn.com/v4/letter/r/f14d63/32.png) [@Reaky](https://community.cesium.com/u/Reaky)\
**Post date:** [June 27, 2018, 3:02pm UTC](https://community.cesium.com/t/programmatically-tiltup-tiltdown/7086/3 "2018-06-27T15:02:39Z")

</div>

Hi,

Thank you for answer but i don't want to subscribe an event or set up controls. I want to programatically tilt the camera as it is in the example.

Thanks

27 Haziran 2018 Çarşamba 17:18:08 UTC+3 tarihinde Gabby Getz yazdı:

---

<div class="post-metadata">

**Author:** ![omar](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/omar/32/1999_2.png) [@omar](https://community.cesium.com/u/omar)\
**Post date:** [June 28, 2018, 5:46pm UTC](https://community.cesium.com/t/programmatically-tiltup-tiltdown/7086/4 "2018-06-28T17:46:44Z")

</div>

Try using the camera’s [lookAt](https://cesiumjs.org/Cesium/Build/Documentation/Camera.html#lookAt)function. It lets you specify a point and an orientation/distance. Here’s an example of making it tilt.

var viewer = new Cesium.Viewer(‘cesiumContainer’);

var origin = Cesium.Cartesian3.fromDegrees(100,1);

var sphere = new Cesium.BoundingSphere(origin, 1e2);

viewer.camera.viewBoundingSphere(sphere);

var time = 0;

viewer.scene.postUpdate.addEventListener(function() {

time += 0.05;

var angle = (Math.cos(time) + 1) \* 0.5 \* 25 + 15;

var heading = Cesium.Math.toRadians(0.0);

var pitch = Cesium.Math.toRadians(-angle);

var range = 1e2;

viewer.camera.lookAt(

origin,

new Cesium.HeadingPitchRange(heading, pitch, range)

);

});

``

Does this do what you want?

---

<div class="post-metadata">

**Author:** ![Reaky](https://avatars.discourse-cdn.com/v4/letter/r/f14d63/32.png) [@Reaky](https://community.cesium.com/u/Reaky)\
**Post date:** [June 28, 2018, 7:35pm UTC](https://community.cesium.com/t/programmatically-tiltup-tiltdown/7086/5 "2018-06-28T19:35:44Z")

</div>

Thank you Omar. That's exactly what I want!

28 Haziran 2018 Perşembe 20:46:44 UTC+3 tarihinde Omar Shehata yazdı:
