Zoom to model added as primitive.

How to zoom to a model added as primitive.I tried with viewer.flyTo and viewer.zoomTo but didnt worked.What could be the reason.

var viewer = new Cesium.Viewer(‘cesiumContainer’);

var origin = Cesium.Cartesian3.fromDegrees(-95.0, 40.0, 200.0);

var modelMatrix = Cesium.Transforms.eastNorthUpToFixedFrame(origin);

var model = viewer.scene.primitives.add(Cesium.Model.fromGltf({

url : ‘…/…/…/…/Apps/SampleData/models/DracoCompressed/CesiumMilkTruck.gltf’,

show : true, // default

modelMatrix : modelMatrix,

scale : 2.0, // double size

minimumPixelSize : 128, // never smaller than 128 pixels

maximumScale: 20000, // never larger than 20000 * model size (overrides minimumPixelSize)

allowPicking : false, // not pickable

debugShowBoundingVolume : false, // default

debugWireframe : false

}));

model.readyPromise.then(function(model) {

// Play all animations when the model is ready to render

model.activeAnimations.addAll();

});

viewer.camera.flyTo(model);

You could try using a primitive’s bounding sphere to zoom to it, in the same way this code example does: https://cesiumjs.org/Cesium/Build/Apps/Sandcastle/index.html?src=3D%20Tiles%20Adjust%20Height.html&label=Post%20Processing

This would be the property you’d need: https://cesiumjs.org/Cesium/Build/Documentation/Model.html?classFilter=Model#boundingSphere