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
onAfterUpdate
readonly
onAfterUpdate:Event
<SimpleCamera
>
Inherited from
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
>
Inherited from
onDisposed
readonly
onDisposed:Event
<string
>
Inherited from
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
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
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
Parameter | Type | Description |
---|---|---|
enabled | boolean | The 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
The current navigation mode.
Methods
dispose()
dispose():
void
Returns
void
Overrides
fit()
fit(
meshes
,offset
):Promise
<void
>
Make the camera view fit all the specified meshes.
Parameters
Parameter | Type | Default value | Description |
---|---|---|---|
meshes | Iterable <Mesh <BufferGeometry <NormalBufferAttributes >, Material | Material [], Object3DEventMap >> | undefined | the meshes to fit. If it is not defined, it will |
evaluate Components.meshes. | |||
offset | number | 1.5 | the 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
isDisposeable()
isDisposeable():
this is Disposable
Whether is component is Disposable.
Returns
this is Disposable
Inherited from
isHideable()
isHideable():
this is Hideable
Whether is component is Hideable.
Returns
this is Hideable
Inherited from
isResizeable()
isResizeable():
this is Resizeable
Whether is component is Resizeable.
Returns
this is Resizeable
Inherited from
isUpdateable()
isUpdateable():
this is Updateable
Whether is component is Updateable.
Returns
this is Updateable
Inherited from
set()
set(
mode
):void
Sets a new NavigationMode and disables the previous one.
Parameters
Parameter | Type | Description |
---|---|---|
mode | NavModeID | The NavigationMode to set. |
Returns
void
setUserInput()
setUserInput(
active
):void
Allows or prevents all user input.
Parameters
Parameter | Type | Description |
---|---|---|
active | boolean | whether to enable or disable user inputs. |
Returns
void
update()
update(
_delta
):void
Parameters
Parameter | Type |
---|---|
_delta | number |
Returns
void
Inherited from
updateAspect()
updateAspect():
void
Updates the aspect of the camera to match the size of the Components.renderer.
Returns
void