Skip to main content

Function: addCameraComponent()

addCameraComponent(world, entity, options?): CameraEcsComponent

Defined in: rendering/components/camera-component.ts:135

Attaches a CameraEcsComponent to entity. A camera also needs a PositionEcsComponent (see addPositionComponent) for createCameraEcsSystem to pan it; use createCamera to get both on a fresh entity in one call.

Parameters

world

EcsWorld

The ECS world entity belongs to.

entity

number

The entity to attach the component to.

options?

Partial<CameraEcsComponent> = {}

Options for configuring the camera.

Returns

CameraEcsComponent

The attached component, for further tuning or runtime changes.