Change te view without changing the camera position?

34 views
Skip to first unread message

ezr...@gmail.com

unread,
Feb 20, 2019, 10:51:16 AM2/20/19
to cesium-dev

scenario:
I am displaying polygon and image texture on him.
I fixture the camera to a place that I can view the polygon image on the map.
How can I zoom IN/OUT or move all over the image without moving the camera position from his place?

Omar Shehata

unread,
Feb 21, 2019, 3:07:32 PM2/21/19
to cesium-dev
Zooming in in CesiumJS is moving the camera forward, so I don't think you can do that without moving the camera.

But you can change the direction by setting camera.direction to a new vector while keeping it in place. This camera Sandcastle is a nice reference of what all you can do:

Scott Reynolds

unread,
Feb 21, 2019, 8:22:39 PM2/21/19
to cesium-dev
Unfortunately, Cesium and other apps misuse the term zoom when what they are doing is called a dolly.  A zoom lens changes the field of view.  See this and this for more information.

ezr...@gmail.com

unread,
Feb 24, 2019, 5:53:22 AM2/24/19
to cesium-dev
thank you for your Response,
I get over that by this way:

For zoom IN/Out without moving the view:
I disabled the default zoom, listen to zoom wheel and increase/decrease the camera fov for getting the same affect of zoom.

viewer.scene.screenSpaceCameraController.enableZoom = false;
handler.setInputAction( (zoomScalar) => {
zoomScalar = zoomScalar / 250;
changedFov -= zoomScalar;
console.log( this.changedFov);
viewer.scene.camera.frustum.fov = Cesium.Math.toRadians( this.changedFov);
}, Cesium.ScreenSpaceEventType.WHEEL);

for moving whitout move the camera origin i disabeld the moving by dragigng
by:
viewer.scene.screenSpaceCameraController.enableRotation = false;
viewer.scene.screenSpaceCameraController.enableTranslate = false;
viewer.scene.screenSpaceCameraController.enableTilt = false;

and create dragigng by the listeners LEFT_DOWN and MOUSE_MOVE
and change the the end position the oreantation with the function :
viewer.camera.lookRight(delta.x);
viewer.camera.lookDown(delta.y);

Reply all
Reply to author
Forward
0 new messages