Skip to main content

Class: CameraManager

Creates and updates camera components.

Constructors​

Constructor​

new CameraManager(): CameraManager;

Returns​

CameraManager

Methods​

Create()​

static Create(entity): Promise<boolean>;

Creates a camera component on an entity.

Parameters​

ParameterTypeDescription
entitynumberThe Entity to update.

Returns​

Promise<boolean>

A promise that resolves to true if the camera component was created, or false otherwise.


Destroy()​

static Destroy(entity): Promise<boolean>;

Removes a camera component from an entity.

Parameters​

ParameterTypeDescription
entitynumberThe Entity to update.

Returns​

Promise<boolean>

A promise that resolves to true if the camera component was removed, or false otherwise.


HasComponent()​

static HasComponent(entity): Promise<boolean>;

Checks whether an entity has a camera component.

Parameters​

ParameterTypeDescription
entitynumberThe Entity to inspect.

Returns​

Promise<boolean>

A promise that resolves to true if the entity has a camera component, or false otherwise.


SetEnabled()​

static SetEnabled(entity, enabled): Promise<void>;

Sets whether a camera component is enabled.

Parameters​

ParameterTypeDescription
entitynumberThe Entity to update.
enabledbooleanWhether the camera component is enabled.

Returns​

Promise<void>

A promise that resolves when the enabled state has been changed.


GetEnabled()​

static GetEnabled(entity): Promise<boolean>;

Gets whether a camera component is enabled.

Parameters​

ParameterTypeDescription
entitynumberThe Entity to inspect.

Returns​

Promise<boolean>

A promise that resolves to true if the camera component is enabled, or false otherwise.


SetRenderTexture()​

static SetRenderTexture(entity, renderTexture): Promise<void>;

Sets the render texture of a camera.

Parameters​

ParameterTypeDescription
entitynumberThe Entity to update.
renderTexturenumberThe Texture to assign as the render texture; it must be a render texture.

Returns​

Promise<void>

A promise that resolves when the render texture has been changed.


GetRenderTexture()​

static GetRenderTexture(entity): Promise<number>;

Gets the render texture of a camera.

Parameters​

ParameterTypeDescription
entitynumberThe Entity to inspect.

Returns​

Promise<number>

A promise that resolves to the assigned Texture.


SetProjectionType()​

static SetProjectionType(entity, projectionType): Promise<void>;

Sets the projection type of a camera.

Parameters​

ParameterTypeDescription
entitynumberThe Entity to update.
projectionTypeProjectionTypeThe projection type to assign.

Returns​

Promise<void>

A promise that resolves when the projection type has been changed.


GetProjectionType()​

static GetProjectionType(entity): Promise<ProjectionType>;

Gets the projection type of a camera.

Parameters​

ParameterTypeDescription
entitynumberThe Entity to inspect.

Returns​

Promise<ProjectionType>

A promise that resolves to the projection type.


SetFieldOfView()​

static SetFieldOfView(entity, fov): Promise<void>;

Sets the field of view of a camera in degrees.

Parameters​

ParameterTypeDescription
entitynumberThe Entity to update.
fovnumberThe field of view in degrees.

Returns​

Promise<void>

A promise that resolves when the field of view has been changed.


GetFieldOfView()​

static GetFieldOfView(entity): Promise<number>;

Gets the field of view of a camera in degrees.

Parameters​

ParameterTypeDescription
entitynumberThe Entity to inspect.

Returns​

Promise<number>

A promise that resolves to the field of view in degrees.


SetOrthographicSize()​

static SetOrthographicSize(entity, orthographicSize): Promise<void>;

Sets the orthographic size of a camera.

This value is used when the projection type is ProjectionType.Orthographic.

Parameters​

ParameterTypeDescription
entitynumberThe Entity to update.
orthographicSizenumberThe orthographic size.

Returns​

Promise<void>

A promise that resolves when the orthographic size has been changed.


GetOrthographicSize()​

static GetOrthographicSize(entity): Promise<number>;

Gets the orthographic size of a camera.

Parameters​

ParameterTypeDescription
entitynumberThe Entity to inspect.

Returns​

Promise<number>

A promise that resolves to the orthographic size.


SetNearClipPlane()​

static SetNearClipPlane(entity, nearClipPlane): Promise<void>;

Sets the near clip plane distance of a camera.

Parameters​

ParameterTypeDescription
entitynumberThe Entity to update.
nearClipPlanenumberThe near clip plane distance.

Returns​

Promise<void>

A promise that resolves when the near clip plane has been changed.


GetNearClipPlane()​

static GetNearClipPlane(entity): Promise<number>;

Gets the near clip plane distance of a camera.

Parameters​

ParameterTypeDescription
entitynumberThe Entity to inspect.

Returns​

Promise<number>

A promise that resolves to the near clip plane distance.


SetFarClipPlane()​

static SetFarClipPlane(entity, farClipPlane): Promise<void>;

Sets the far clip plane distance of a camera.

Parameters​

ParameterTypeDescription
entitynumberThe Entity to update.
farClipPlanenumberThe far clip plane distance.

Returns​

Promise<void>

A promise that resolves when the far clip plane has been changed.


GetFarClipPlane()​

static GetFarClipPlane(entity): Promise<number>;

Gets the far clip plane distance of a camera.

Parameters​

ParameterTypeDescription
entitynumberThe Entity to inspect.

Returns​

Promise<number>

A promise that resolves to the far clip plane distance.