Pictofit / Web SDK / 7.3.1 / Manual Scene Setup

Manual Scene Setup

In some cases, you might want to interact with the babylon.js scene directly to achieve a certain behavior or to add an element that is not supported through the configuration file system of our SDK. This is fairly simple since the WebViewer gives access to the BABYLON.Scene property. The following example shows how to add a light source from code.

let viewer = new Pictofit.WebViewer("canvas3d");
let pointLight = new BABYLON.PointLight("MyPointLight", new BABYLON.Vector3(0, 10, 0), viewer.scene);

You can also alter the scene after it has been loaded to override certain properties. Subscribe to the respective event to make sure that the scene has finished loading before modifying it.

let viewer = new Pictofit.WebViewer("canvas3d");
viewer.onLoadingFinished = () => {
  let mainLight = viewer.scene.getLightByName("mainLight");
  mainLight.isEnabled = false;
}
CONTENT
© 2014-2020 Reactive Reality AG