Smooth camera when tracking an entity


I know this has probably come up a few times in different ways, but I am attempting to “smoothly” follow an entity along a path with the camera, whilst keeping the camera quite natural.

I followed the sandbox example and can track an entity along a path (easy enough), but the camera doesn’t seem very natural. i.e. its fixed above the entity.

The doarama camera is much more natural looking and I am looking to achieve something similar. I’m not sure what components I would need to achieve something similar.

Any help would be great


I haven’t looked at the Doarama’s code, but observing the movement it seems to do something like this:

The farther away a property value is from it’s target value the faster the camera travels to this target value.

There’s a target range that you can alter with mouse-wheel.

Target heading is the heading from camera to entity.

Target pitch seems to be somewhere in the neighborhood of say -10 to -30 degrees pitch.

Also when paused it slowly rotates the camera around the surface normal at the entity to keep it lively.

I believe it is custom tracking code not part of Cesium, probably executed via .onTick or .preRender.

The info window is quite sophisticated as well; you can drag it around via the title bar or resize it by dragging a side or a corner, and click the photo to swap (3d to small window, photo to large window.)

I also like Doarama’s camera.

I have a question regarding camera, how to allow the camera to rotate below the surface ? (As sometimes i need view model closely from below)

viewer.scene.screenSpaceCameraController.minimumZoomDistance = -300 will let you go 300 meters under the surface, though you’ll see terrain skirt grids while underground.

Thanks Hyper Sonic !

Hyper Sonic gmanmilli@gmail.com于2015年5月11日星期一写道:

Thanks Hyper,

It does seem quite advanced. I’ll map out what I am trying to achieve and list the steps based on what you have said. Would be great to have something like this bundled into cesium :slight_smile: