Switching Cameras

How do you code cameras to switch in Cospaces?


you can use “Switch to camera {camera name}” CoBlock in Actions category or set the active flag for the camera from typescript:

(Scene.getItem('camera1') as CameraItem).active = true;

The script you suggested doesn’t seem to work for me. I tried just activating a new camera on startup and it’s simply not working.

Hi @hw_mark, this is probably from an older version of the public API. Using the latest version, you can set the Camera via Camera.focusedItem, so try this format instead:

Camera.focusedItem = Scene.getItem('TigerCam') as CameraItem;

and see this working remixable example:

Hope this helps! Let me know if you have any further questions about this.

Many thanks,
Geoff @ TechLeap

This did work! I can’t mark it as a solution because I’m not the OP though.

1 Like