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 :
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 :
Hi there,
Set the ScreenSpaceCameraController.tiltEventTypes to the CameraEventType you want, in this case CameraEventType.WHEEL.
Thanks,
Gabby
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ı:
Try using the camera’s 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?
Thank you Omar. That's exactly what I want!
28 Haziran 2018 Perşembe 20:46:44 UTC+3 tarihinde Omar Shehata yazdı: