Viewing multiple objects in same viewer as time advances

I am trying to set the camera up so that both entities are always in view as they move through a designated path. I have the ability to track each individually but not both in the same viewer. Any help or resources would be greatly appreciated.

Hey Zac,

I think the best way to do that would be control the camera directly. For example, you could get both entity’s position, compute the midpoint, and get the camera to look at that with the lookAt function (https://cesiumjs.org/Cesium/Build/Documentation/Camera.html?classFilter=camera#lookAt).

Another quick way to do it would be to define an invisible entity that’s always in the midpoint between them, and perhaps dynamically set the camera zoom to be the distance between the two entities so it zooms out as they move apart to keep them both in view.

Check out this camera docs as well as this tutorial: https://cesiumjs.org/tutorials/Camera-Tutorial/

Hope this helps!