Instances

Change the pose of an instance

To change the position of an instance, you can pass a pose object into the setPose method. You can access the current pose through the pose property of an instance. In the snippet below, the instance of the previous example is used for simplicity.

const oldPosition = instance.pose.position;

await instance.setPose({ 
    position: {
        x: oldPosition.x + 300,
        y: 200,
        z: 300
    }
});

The new pose object is merged with the old one, so you do not need to provide every single pose property.

Change visibility

To change the visibility of an instance, you can use the setVisibility method:

await instance.setVisibility(true);
await instance.setVisibility(false);

It is also possible to set the visibility while inserting a model or a container into a scene by passing the visible property into the configuration object.

const model = await modelManager.getModelFromRepository(20);
await sceneManager.insertModel(model, { visible: false });