# Move Camera

With the moveCamera API you can animate the camera angle and position freely within the scene.

RoomleConfigurator.moveCamera({
    yaw: -0.785,
    pitch: 0,
    distance: 1,
    targetX: 0, targetY: 0.5, targetZ: 0,
    blockOtherTweens: true
});

For a full list and explanation of the parameters check the Camera Parameter Interface.

# Render image of current camera perspective

Here is an example of how to render an image with current camera perspective and then create new HTML img element.

const base64Image = await RoomleConfigurator.renderImage({useCurrentPerspective: true});
const img = document.createElement('img');
img.src = base64Image.image;
img.id = 'perspectiveImage';
img.style = 'width: ' + base64Image.width + '; height: ' + base64Image.height + '; position: fixed; top: 0; right: 0; border: solid 1px black';
document.body.appendChild(img);

If you set the parameter to false it will use the default perspective.

# Manipulating the scene

With the getScene and updateScene APIs it's possible to get the current three.js scene (opens new window) (as a reference) and therefore delete and add objects as you need. After you've changed the scene you need to call updateScene to re-render the scene and reflect your changes.

For example if you want to see which objects are present in the scene you can call

const sceneObjects = RoomleConfigurator.getScene().children;

You can then remove or manipulate the scene objects. If you want to add a new object to the scene you can call

const object = new THREE.Object3D();
// set material, geometry etc.
RoomleConfigurator.getScene().add(object);
RoomleConfigurator.updateScene();

WARNING: Depending on what you change in the scene, the use of this API may break behaviour/funcionality of the configurator!