Move the eye point on the cesium widget

91 views
Skip to first unread message

websim...@gmail.com

unread,
Jun 8, 2016, 5:08:27 AM6/8/16
to cesium-dev
Hi All,

Excuse me for my ignorance on the topic. I am not an expert in matrices, transformations, etc. What I want to achieve is quite simple to explain, however I have no idea how to address it.

I have cesium widget which shows 3D scene. I use camera.setView to move eye point to specific position based on lon, lat, height and provide roll and pitch. The eye point in this scenario is always center of my widget (intersection of diagonals of my canvas container rectangle). Now I would like to move that eye point with pixel offset (e.g. 100 pixel up and 50 to the left). I still need my eye to look at the exactly the same point of the ellipsoid , however I need to see more of 3D scene below my eyes and more on the right.

Could someone enlighten me how to do this. Many thanks in advance.

Marcin

websim...@gmail.com

unread,
Jun 9, 2016, 10:21:58 AM6/9/16
to cesium-dev


Below is what I want to achieve. Curretnly when I use


        viewer.camera.setView({
            destination: Cesium.Cartesian3.fromDegrees(lon, lat, height),
            orientation: {
                heading: Cesium.Math.toRadians(direction), // value is 0.0 (north)
                pitch: Cesium.Math.toRadians(-pitch),    // 0 - straight
                roll: Cesium.Math.toRadians(-roll)     // 0 - horizontal
            }
        });


the eye point is in the center of the screen. Now, having the camera at the same position and looking at exactly same point on the ground, I would like to see more of the terrain below and right, as indicated on the screen below by blue space.


any hints please, help .....


websim...@gmail.com

unread,
Jun 24, 2016, 5:59:19 AM6/24/16
to cesium-dev
UP & Please help ... can't solve it myself ...

Hannah Pinkos

unread,
Jun 24, 2016, 9:57:08 AM6/24/16
to cesium-dev
Hello,

Sorry I missed your question before.  You might be able to solve your problem by using the Camera.lookAt function with the Cesium.HeadingPitchRange argument.  Here is a code example:

     var center = Cesium.Cartesian3.fromDegrees(-72.0, 40.0);
     
var heading = Cesium.Math.toRadians(50.0);
     
var pitch = Cesium.Math.toRadians(-20.0);
     
var range = 5000.0;
     viewer
.camera.lookAt(center, new Cesium.HeadingPitchRange(heading, pitch, range));

Best,

Hannah
Reply all
Reply to author
Forward
0 new messages