Center postion of viewport


I am trying to get center position of the viewport.

Let me explain what i am trying to acheive whenever I do drag using mouse pointer or zoom in on the cesium globe it should give center position of the viewport.

Can anyone help?

Thanks in advance.


You’d want to pull the viewer.scene.canvas object and get half it’s height and width, then load that into a to return a cartesian3 of the center of the viewport.

You can find a somewhat similar example in Terria.js, shoutout to @NICTA and Kevin for full credit: