Set camera position and target when initiating model

How can I update a model’s camera position before it’s shown (showSceneMode: 1 and scene.show is false). Using camera.updateAsync(newPositionObject, {duration: 0}) after updateSettingAsync(“scene.show”) works but, I don’t like the blur on load.

Can I update the camera’s default position (via the API)? Does updateSettingAsync(“scene.show”, true) always load the default position (i.e. digging into Three.js isn’t going to solve this)?

I’m currently using camera.updateAsync(newPositionObject, {duration: 0}) and delaying the visibility via CSS to achieve the desired effect.

You can disable the blur with

api.updateSettingAsync('blurSceneWhenBusy', false),

see details in the API reference.

Updating camera works with api.scene.camera.updateAsync() and if you want to update the default position without re-uploading just go to model edit page, paste the call with new camera position in the console and then hit the Apply Settings button.

1 Like

Thanks Pavol.

Calling updateSettingAsync(‘blurSceneWhenBusy’, false) before camera.updateAsync(…) enabled me to shorten the CSS transition effect by 0.5s.

It’s not very elegant but this has accomplished what I was looking to do:
await api.updateSettingAsync(‘blurSceneWhenBusy’, false);
await api.updateSettingAsync(“scene.show”, true);
await api.scene.camera.updateAsync(newPositionObject, {duration: 0});
await api.updateSettingAsync(‘blurSceneWhenBusy’, true);

Updating the default camera via the model edit page is not what I’m looking to do as I want to define the camera position at runtime as it’s shown.

This code shows how to update any settings before loading the model:

Thanks! Your code pen enabled me to figure out how to do it:

 await api.updateSettingsAsync({
     scene: {
         camera: {
             cameraTypes: {
                perspective: {
                    default: newPositionObject
                }
            }
        }
    }
});