Skip to main content

Camera

This section provides guidance on setting up the Camera. The Camera component system allows you to create and control the camera view.

A camera is provided by default in a new Studio project, however you can also add a Camera to a scene using the + Object dropdown on the Space Hierarchy. Additionally, a camera can be added to an entity via Studio’s Add Component interface or in code.

CameraNewObject

You can transform the camera view using the transform tooling. You can test the camera view using the Simulator. Make sure the Set Active Camera setting is on.

CameraNewObject

CameraSetActive

There are three types of Cameras in Studio: 3D only, Face, and World. Each of these camera types will have different settings. A Face or a World Camera is necessary for AR experiences. To learn more about building AR experiences see the XR section.

CameraProperties1

CameraProperties2

Set Active Camera

world.camera.setActiveEid(component.eid)

Get Active Camera

world.camera.getActiveEid()

Listen for Active Camera Change

world.events.addListener(world.events.globalId, ecs.CameraEvents.ACTIVE_CAMERA_CHANGE, (e) => {
const activeCamera = e.data.camera
})

Listen for Active Camera EID Change

world.events.addListener(world.events.globalId, ecs.CameraEvents.ACTIVE_CAMERA_EID_CHANGE, (e) => {
const activeCameraEid = e.data.eid
})