Locking camera to above the equator

I’ve been trying to lock the camera so LMB dragging will only spin the Earth left and right around the equator, without much luck. Any ideas?

The camera object is available, but I’m not sure what to change to snap it in place, e.g. maybe something as simple as constantly setting camera.position.y = 0 on update

I have a suspicion that it is easy to do if you know the internals of Cesium :slight_smile:


Hi Gerald,

I apologize for the late response. The camera system has been undergoing some major changes. You can check out at the camera branch or pull request #282 if you’re interested. Unfortunately, there isn’t a simple way to lock the camera to rotating around the equator, but, as you mentioned, you can try modifying the camera on update. Here is what you would need to do:

camera.position.z = 0.0; // set the camera to be in the xy-plane

camera.up = Cartesian3.UNIT_Z; // set the up direction to point north

camera.direction = camera.position.negate().normalize(); // set the view direction to the center of the earth

camera.right = camera.direction.cross(camera.up) // compute the right direction

Let me know if this helps.


Hi Dan,

Thank you for your response. I’m not allocated time to work on our Cesium based project right now, but I’ll let you know how well this works (and check out the branch) when I get back on it.

Hopefully it’ll be sooner than later :slight_smile: