Skip to content

Class: CameraComponent ​

Projection + render-pass config layered on top of the entity's TransformComponent (which supplies camera world position and rotation). Cameras are sorted by depth ascending; same-depth ties break in scene-discovery order.

Culling: entity is rendered iff (cullingMask & (1 << entity.layer)) !== 0. Entities without a LayerComponent are treated as layer 0.

Orthographic view: half-height in world units = orthographicSize; width follows viewport aspect. Perspective view: standard pinhole with vertical FOV in degrees, nearClip > 0, farClip > nearClip.

Extends ​

Constructors ​

Constructor ​

ts
new CameraComponent(): CameraComponent;

Returns ​

CameraComponent

Overrides ​

Component.constructor

Properties ​

PropertyModifierTypeDefault valueDescriptionInherited from
canvaspublicCanvasComponent | nullundefined--
clearAlphapublicnumberundefined--
clearColorpublicnumberundefined--
clearFlagspublicClearFlagsundefined--
clipToViewportpublicbooleanundefinedWhen true, content rendered through this camera is clipped to its viewport rect — required for clean multi-camera composition. Disable to allow drawing outside the canvas/viewport bounds (debug overlays, oversized effects, off-screen previews).-
cullingMaskpublicnumberundefined--
depthpublicnumberundefined--
dirtypublicbooleantrue-Component.dirty
enabledpublicbooleantrue-Component.enabled
farClippublicnumberundefined--
fieldOfViewpublicnumberundefined--
fitCanvaspublicbooleanundefinedOrthographic only: frame a Canvas — the ortho size follows its reference size and scale mode (Cocos "align with screen"). Off = orthographicSize. canvas picks which one; null = the scene's first enabled Canvas.-
nearClippublicnumberundefined--
orthographicSizepublicnumberundefined--
postMaterialspublicstring[]undefined'post'-domain material ids applied to everything this camera draws, in order. Reassign the array to change it (the renderer caches per array).-
projectionpublicProjectionModeundefined--
targetTexturepublicstringundefined--
viewportHeightpublicnumberundefined--
viewportWidthpublicnumberundefined--
viewportXpublicnumberundefined--
viewportYpublicnumberundefined--

© 2026 PlayAdGentic