Camera
Spawn an additional camera entity. Useful for cinematics, picture-in-picture, or AR cameras.
ts
import { Behaviour } from "@relu-interactives/spatial-ecs";
export default class SpawnCamera extends Behaviour {
init() {
const objects = this.world.getObjectManagementSystem();
objects?.requestCreate("camera", {
name: "Cinematic",
transform: { position: { x: 0, y: 2, z: 5 } },
options: {
type: "3d",
projection: "perspective",
fov: 50,
near: 0.1,
far: 1000,
},
});
}
}Payload
| Field | Type | Default | Description |
|---|---|---|---|
name | string | "Camera" | Display name. |
transform | TransformData | identity | Position / rotation / scale. |
useWorldCamera | boolean | false | Reuse the existing world camera object instead of creating a new one (only honored at runtime, not in the editor). |
parentId | EntityId | null | null | Optional parent entity. |
options
| Option | Type | Default | Description |
|---|---|---|---|
type | "3d" | "ar" | "3d" | Logical camera type (used by tracking systems). |
isDefault | boolean | false | Mark this camera as the default render camera. |
projection | "perspective" | "orthographic" | "perspective" | Projection model. |
fov | number | 60 | Vertical field of view (degrees). Perspective only. |
near | number | 0.1 | Near clip plane. |
far | number | 1000 | Far clip plane. |
left / right / top / bottom | number | ±half-height | Orthographic frustum edges. |
zoom | number | 1 | Orthographic zoom. |
Components attached
Transform, Object3DRef, Name, EntityType, ParentId, Selectable, Camera.

