Move camera to bring point on ellipsoid into pre-determined screen position

Hello all,

This little problem has proven to be far more challenging than I expected. Now that I think about it, there’s probably an infinite number of solutions. But let me explain the principle:

My map has billboards. When the user clicks on a billboard, an overlay appears on top of the Cesium canvas. The user can drag this overlay anywhere on screen to “get it out of the way”. When the user drags the map, this overlay moves along as well, preserving some constant (pixel) distance from the billboard. One of the views inside this overlay is a gallery of photo thumbs. When the user clicks on a photo, I want to move the map behind the overlay, so the location of the photo is near the top-left corner of the overlay (or some other predetermined screen position). Moving the overlay is not an option. There are a lot of variables here, so for the sake of simplicity let’s assume that I want to leave the camera at the same height above the ellipsoid and I’m not going to worry too much about possible terrain occlusion. I just want to highlight a location and make sure it’s not behind the overlay.

I forgot to mention that my camera only points north. The position and target always have the same longitude.

Hopefully this made some sense. Thanks in advance.


A picture is worth (at least) 1000 words.

Hi Peter,
  i am student and i want to plot 3d graph using cesium. i don't know much how to do it. could you please help me with some code. I will be thankful to you.
Thanks, in advacne for your help!!


Abhishek kumar