Camera controls like its mounted on a tripod.

I’ve been struggling with this problem for a few days and not really making a ton of progress.

I need to setup a camera control that acts like its on a tripod.

I got to the point where I figured out that I could use Camera.setView and just change heading and pitch without changing the destination.

However now I need to add zoom. Unfortunately cesium doesn’t do a proper zoom using focal length and instead moves the camera position. However because the camera position is moved, translation of the heading and pitch are now based upon the new position instead of the original position.

I tried using a parametric equation for a circle:

(x,y) = (a + r * cos(theta), b + r * sin(theta))

(a,b) = center of the circle
r = radius of the circle
(x,y) = the point on the radius of the circle at angle theta

Which would yield the correct translation of x,y to x2,y2 as:

(x,y) = (a + r * cos(theta + phi), b + r * sin(theta + phi))

Where phi is the translation angle of x,y rotatating around a,b.

I had tried getting this to work, but it’s just not working right - and still have to do similar translation for pitch.

Wondering if anyone has done this for both heading and pitch and has some sample code they could share?


This thread talks about one possible way of zooming in properly by altering the camera frustum:

Setting the camera’s transform could also be another easy way to fix it at a location:

Let me know if any of that helps!