With viewer.trackedEntity, can't mousewheel the camera close enough to tracked entity

I have 3D model that I wan't to be able to pan around and zoom towards and away from. I actually created the model as a primitive so in order to be able to use trackedEntity I actually created a small transparent ellipsoid entity that I positions at the same position as my model and set that as the tracked entity.
This works and I am able to pan around my model and zoom towards and away from my model using the mouse wheel. However, the model is a smallish model (eagle size) and I can't get the mouse wheel to zoom me close enough to the model for the screenshots I want to take.

What is preventing the camera moving right up the model and is there a way to override this?


You can set the viewer.scene.screenSpaceCameraController.minimumZoomDistance, but this will be set automatically based on the size of your ellipsoid when you set trackedEntity. You can override after you assign the tracked entity though. If you’re still having problems, let us know.

Hi Matthew, thank you for the response. Unfortunately this suggestion does not let me move the camera any closer to the model than before. I make the call after the trackedEntity assignment and verified that the value was 20 prior to setting it to 1, and 1 after but I still not able to move the camera any closer to the model.

Any other ideas?



setting trackedEntity is actually asynchronous, so that might be part of the problem. Can you add some debug code to print out the value of the minimumZoomDistance every frame? Then see if it’s what you expect once the tracking actually begins. How small is your model?

I’m not sure what you mean by ‘once the tracking actually begins’. I’m not tracking it with an animation sequence or any timer, I’m moving around it interactively with the mouse. I have looked at the value of viewer.scene.screenSpaceCameraController.minimumZoomDistance with the developer tools of Chrome at a breakpoint and it set to one.

I also don’t know how ‘big’ the model is. I bought it from an exchange. It is supposed to represent an object about 18 inches across, but I am not tracking that directly, I am tracking an ellipsoid created with dimensions 0.05,0.05,0.05.

_trackedEntity = _entities.add({

                position: position,

                ellipsoid: {

                    radii: new Cesium.Cartesian3(0.05, 0.05, 0.05),

                    outline: false,

                    material: Cesium.Color.fromRandom({ alpha: 0.0 })



            _viewer.trackedEntity = _trackedEntity;

            _viewer.scene.screenSpaceCameraController.minimumZoomDistance = 1;