Skip to main content

OrthoPerspectiveCamera

A flexible camera that uses yomotsu's cameracontrols to control the camera in 2D and 3D. It supports multiple navigation modes, such as 2D floor plan navigation, first person and 3D orbit. This class extends the SimpleCamera class and adds additional functionality for managing different camera projections and navigation modes. 📕 Tutorial. 📘 API.

Extends

Properties

currentWorld

currentWorld: null | World = null

The current world this item is associated with. It can be null if no world is currently active.

Inherited from

SimpleCamera . currentWorld


onAfterUpdate

readonly onAfterUpdate: Event <SimpleCamera>

Updateable.onAfterUpdate

Inherited from

SimpleCamera . onAfterUpdate


onAspectUpdated

readonly onAspectUpdated: Event<unknown>

Event that is triggered when the aspect of the camera has been updated. This event is useful when you need to perform actions after the aspect of the camera has been changed.

Inherited from

SimpleCamera . onAspectUpdated


onBeforeUpdate

readonly onBeforeUpdate: Event <SimpleCamera>

Updateable.onBeforeUpdate

Inherited from

SimpleCamera . onBeforeUpdate


onDisposed

readonly onDisposed: Event<string>

Disposable.onDisposed

Inherited from

SimpleCamera . onDisposed


onWorldChanged

readonly onWorldChanged: Event<object>

Event that is triggered when a world is added or removed from the worlds map. The event payload contains the world instance and the action ("added" or "removed").

Type declaration

action

action: "added" | "removed"

world

world: World

Inherited from

SimpleCamera . onWorldChanged


projection

readonly projection: ProjectionManager

A ProjectionManager instance that manages the projection modes of the camera.


three

three: PerspectiveCamera | OrthographicCamera

A three.js PerspectiveCamera or OrthographicCamera instance. This camera is used for rendering the scene.

Inherited from

SimpleCamera . three


threeOrtho

readonly threeOrtho: OrthographicCamera

A THREE.OrthographicCamera instance that represents the orthographic camera. This camera is used when the projection mode is set to orthographic.


threePersp

readonly threePersp: PerspectiveCamera

A THREE.PerspectiveCamera instance that represents the perspective camera. This camera is used when the projection mode is set to perspective.

Accessors

controls

get controls(): CameraControls

The object that controls the camera. An instance of yomotsu's cameracontrols. Transforming the camera directly will have no effect: you need to use this object to move, rotate, look at objects, etc.

Returns

CameraControls


enabled

get enabled(): boolean

Getter for the enabled state of the camera controls. If the current world is null, it returns false. Otherwise, it returns the enabled state of the camera controls.

set enabled(enabled): void

Setter for the enabled state of the camera controls. If the current world is not null, it sets the enabled state of the camera controls to the provided value.

Parameters

ParameterTypeDescription
enabledbooleanThe new enabled state of the camera controls.

Returns

boolean

The enabled state of the camera controls.


mode

get mode(): NavigationMode

Getter for the current navigation mode. Throws an error if the mode is not found or the camera is not initialized.

Throws

Throws an error if the mode is not found or the camera is not initialized.

Returns

NavigationMode

The current navigation mode.

Methods

dispose()

dispose(): void

Disposable.dispose

Returns

void

Overrides

SimpleCamera . dispose


fit()

fit(meshes, offset): Promise<void>

Make the camera view fit all the specified meshes.

Parameters

ParameterTypeDefault valueDescription
meshesIterable<Mesh<BufferGeometry<NormalBufferAttributes>, Material | Material[], Object3DEventMap>>undefinedthe meshes to fit. If it is not defined, it will
evaluate Components.meshes.
offsetnumber1.5the distance to the fit object

Returns

Promise<void>


hasCameraControls()

hasCameraControls(): this is CameraControllable

Checks whether the instance is CameraControllable.

Returns

this is CameraControllable

True if the instance is controllable, false otherwise.

Inherited from

SimpleCamera . hasCameraControls


isConfigurable()

isConfigurable(): this is Configurable<any, any>

Whether is component is Configurable.

Returns

this is Configurable<any, any>

Inherited from

SimpleCamera . isConfigurable


isDisposeable()

isDisposeable(): this is Disposable

Whether is component is Disposable.

Returns

this is Disposable

Inherited from

SimpleCamera . isDisposeable


isHideable()

isHideable(): this is Hideable

Whether is component is Hideable.

Returns

this is Hideable

Inherited from

SimpleCamera . isHideable


isResizeable()

isResizeable(): this is Resizeable

Whether is component is Resizeable.

Returns

this is Resizeable

Inherited from

SimpleCamera . isResizeable


isUpdateable()

isUpdateable(): this is Updateable

Whether is component is Updateable.

Returns

this is Updateable

Inherited from

SimpleCamera . isUpdateable


set()

set(mode): void

Sets a new NavigationMode and disables the previous one.

Parameters

ParameterTypeDescription
modeNavModeIDThe NavigationMode to set.

Returns

void


setUserInput()

setUserInput(active): void

Allows or prevents all user input.

Parameters

ParameterTypeDescription
activebooleanwhether to enable or disable user inputs.

Returns

void


update()

update(_delta): void

Updateable.update

Parameters

ParameterType
_deltanumber

Returns

void

Inherited from

SimpleCamera . update


updateAspect()

updateAspect(): void

Updates the aspect of the camera to match the size of the Components.renderer.

Returns

void

Inherited from

SimpleCamera . updateAspect