Skip to main content

Editor.Components.Camera

Class

Renders the scene from a viewpoint with configurable projection and output.

Index

Example

const model = this.pluginSystem.findInterface(Editor.Model.IModel) as Editor.Model.IModel;
const scene = model.project.scene;

// Access the main camera and configure it
const cam = scene.mainCamera;
if (Editor.isNull(cam)) {
console.log('No main camera');
return;
}

// Configure as perspective camera
cam.cameraType = Editor.Components.CameraType.Perspective;
cam.fov = 60;
cam.near = 0.1;
cam.far = 1000;
cam.renderOrder = 0;
console.log(`Camera: type=Perspective, fov=${cam.fov}, near=${cam.near}, far=${cam.far}`);
console.log(` renderOrder=${cam.renderOrder}, aspect=${cam.aspect}`);

Extends

Properties

aspect

aspect: number

Width-to-height ratio of the camera view.


aspectPreset

aspectPreset: CameraAspectPreset

Preset aspect ratio option.


cameraType

cameraType: CameraType

Projection type (perspective or orthographic).


clearColor

clearColor: CameraClearColor

Background color rendered before scene content.


clearDepth

clearDepth: CameraClearDepth

Depth buffer clearing behavior.


depthMode

depthMode: CameraDepthBufferMode

Depth buffer format and configuration.


deviceProperty

deviceProperty: CameraDeviceProperty

Device camera properties (aspect, FOV, or both) to inherit from the physical camera.


enabled

enabled: boolean

Whether the component is active.

Inherited from

RenderLayerOwner.enabled


far

far: number

Far clipping plane distance.


fov

fov: number

Vertical field of view in degrees.


hasPrefabChanges

readonly hasPrefabChanges: boolean

Whether this entity differs from its counterpart in the prefab or was added to the prefab instance. Always false outside prefab instances.

Inherited from

RenderLayerOwner.hasPrefabChanges


id

readonly id: Uuid

The unique id of the entity.

Inherited from

RenderLayerOwner.id


inputTexture

inputTexture: Texture

Texture used as the camera's input (background) image.


isPrefabInstanceRoot

readonly isPrefabInstanceRoot: boolean

Whether this entity is the root of a prefab instance.

Inherited from

RenderLayerOwner.isPrefabInstanceRoot


maskTexture

maskTexture: Texture

Texture used to mask camera output.


meta

readonly meta: Meta

Metadata associated with this entity, providing access to its unique identifier and other descriptive properties.

Inherited from

RenderLayerOwner.meta


mipmapLevel

mipmapLevel: number

Mip level at which to render the camera.


name

name: string

Name of the component.

Inherited from

RenderLayerOwner.name


near

near: number

Near clipping plane distance.


oitLayers

oitLayers: CameraOitLayers

Order-independent transparency layer configuration.


orthographicSize

readonly orthographicSize: vec2

Height of the orthographic view in world units.


renderLayer

renderLayer: LayerSet

The set of render layers this component belongs to.

Inherited from

RenderLayerOwner.renderLayer


renderOrder

renderOrder: number

Rendering priority relative to other cameras.


renderTarget

renderTarget: RenderTarget

Output texture or framebuffer for rendering.


sceneObject

readonly sceneObject: SceneObject

Scene object this component is attached to.

Inherited from

RenderLayerOwner.sceneObject


size

size: number

Size of the camera's render region.


type

readonly type: string

The entity's type.

Inherited from

RenderLayerOwner.type

Methods

getDirectlyReferencedEntities()

getDirectlyReferencedEntities(): Entity[]

A list of entities which this entity has a reference to.

Returns

Entity[]

Inherited from

RenderLayerOwner.getDirectlyReferencedEntities


getMeta()

static getMeta(): Meta

Returns metadata about this type.

Returns

Meta

Overrides

RenderLayerOwner.getMeta


getOwnedEntities()

getOwnedEntities(): Entity[]

A list of entities which has a reference to this entity.

Returns

Entity[]

Inherited from

RenderLayerOwner.getOwnedEntities


getPrefabInstanceRoot()

getPrefabInstanceRoot(): Prefabable

Returns the nearest prefab instance root that contains this entity, starting with the entity itself, or null if it is not part of a prefab instance.

Returns

Prefabable

Inherited from

RenderLayerOwner.getPrefabInstanceRoot


getTypeName()

static getTypeName(): string

Returns the type name of this class.

Returns

string

Overrides

RenderLayerOwner.getTypeName


getTypeName()

getTypeName(): string

Returns the name of this object's type.

Returns

string

Inherited from

RenderLayerOwner.getTypeName


isOfType()

isOfType(type): boolean

Returns true if the object is of the specified type.

Parameters

ParameterType
typestring

Returns

boolean

Inherited from

RenderLayerOwner.isOfType


isSame()

isSame(other): boolean

Returns true if this object refers to the same instance as the given object.

Parameters

ParameterType
otherScriptObject

Returns

boolean

Inherited from

RenderLayerOwner.isSame