Hi @DAUD, if I understand well, I have a little trick to make this happen:
//Pause the scene to avoid displaying any changes, for example camera movements.
api.scene.pause();
//Set a timeout to be sure the scene has been paused.`
setTimeout(function () {
//store current camera position
var currentCamera = api.scene.camera.get().data;
//position your camera in the angle in which you want to see your object with a 0 duration
api.scene.camera.updateAsync({
position:{x:1000,y:1000,z:1000},
target:{x:0,y:0,z:0}
},
{
duration: 0
}
).then(function () {
//zoom you camera in the object you want to see with a 0 duration
api.scene.camera.zoomAsync([scenePath], { duration: 0 }).then(function () {
//store the final camera position after the zoom
var zoomCamera = api.scene.camera.get().data;
//Go back to the original camera position with duration 0
api.scene.camera.updateAsync(currentCamera, { duration: 0 }).then(function () {
//resume your viewer
api.scene.resume();
//set timeout to make sure the scene was resumed and send the camera update with the info obtained from the previous zoom
setTimeout(function () {
api.scene.camera.updateyAsync(zoomCamera, { duration: 2000});
}, 5);
});
});
});
}, 5);
I hope this helps!