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
Properties
| Property | Modifier | Type | Default value | Description | Inherited from |
|---|---|---|---|---|---|
canvas | public | CanvasComponent | null | undefined | - | - |
clearAlpha | public | number | undefined | - | - |
clearColor | public | number | undefined | - | - |
clearFlags | public | ClearFlags | undefined | - | - |
clipToViewport | public | boolean | undefined | When 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). | - |
cullingMask | public | number | undefined | - | - |
depth | public | number | undefined | - | - |
dirty | public | boolean | true | - | Component.dirty |
enabled | public | boolean | true | - | Component.enabled |
farClip | public | number | undefined | - | - |
fieldOfView | public | number | undefined | - | - |
fitCanvas | public | boolean | undefined | Orthographic 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. | - |
nearClip | public | number | undefined | - | - |
orthographicSize | public | number | undefined | - | - |
postMaterials | public | string[] | undefined | 'post'-domain material ids applied to everything this camera draws, in order. Reassign the array to change it (the renderer caches per array). | - |
projection | public | ProjectionMode | undefined | - | - |
targetTexture | public | string | undefined | - | - |
viewportHeight | public | number | undefined | - | - |
viewportWidth | public | number | undefined | - | - |
viewportX | public | number | undefined | - | - |
viewportY | public | number | undefined | - | - |