Skip to main content
Version: 3.x

Class: DefaultCameraManager

@cognite/reveal.DefaultCameraManager

Default implementation of CameraManager. Uses target-based orbit controls combined with keyboard and mouse navigation possibility. Supports automatic update of camera near and far planes and animated change of camera position and target.

Implements

Properties

automaticControlsSensitivity

automaticControlsSensitivity: boolean = true

When false, the sensitivity of the camera controls will not be updated automatically. This can be useful to better control the sensitivity of the 3D navigation.

When not set, control the sensitivity of the camera using viewer.cameraManager.cameraControls.minDistance and viewer.cameraManager.cameraControls.maxDistance.

Defined in

packages/camera-manager/src/DefaultCameraManager.ts:85


automaticNearFarPlane

automaticNearFarPlane: boolean = true

When false, camera near and far planes will not be updated automatically (defaults to true). This can be useful when you have custom content in the 3D view and need to better control the view frustum.

When automatic camera near/far planes are disabled, you are responsible for setting this on your own.

example

viewer.camera.near = 0.1;
viewer.camera.far = 1000.0;
viewer.camera.updateProjectionMatrix();

Defined in

packages/camera-manager/src/DefaultCameraManager.ts:77

Accessors

cameraControls

get cameraControls(): ComboControls

Gets instance of camera controls that are used by camera manager. See ComboControls for more information on all adjustable properties.

deprecated Will be removed in 4.0.0.

Returns

ComboControls

Defined in

packages/camera-manager/src/DefaultCameraManager.ts:144


cameraControlsEnabled

get cameraControlsEnabled(): boolean

Gets whether camera controls through mouse, touch and keyboard are enabled.

deprecated Will be removed in 4.0.0. Use DefaultCameraManager.enabled instead.

Returns

boolean

Defined in

packages/camera-manager/src/DefaultCameraManager.ts:178

set cameraControlsEnabled(enabled): void

Sets whether camera controls through mouse, touch and keyboard are enabled. This can be useful to e.g. temporarily disable navigation when manipulating other objects in the scene or when implementing a "cinematic" viewer.

deprecated Will be removed in 4.0.0. Use DefaultCameraManager.enabled instead.

Parameters

NameType
enabledboolean

Returns

void

Defined in

packages/camera-manager/src/DefaultCameraManager.ts:169


enabled

get enabled(): boolean

Gets whether camera controls through mouse, touch and keyboard are enabled.

Returns

boolean

Implementation of

CameraManager.enabled

Defined in

packages/camera-manager/src/DefaultCameraManager.ts:159

set enabled(enabled): void

Sets whether camera controls through mouse, touch and keyboard are enabled.

Parameters

NameType
enabledboolean

Returns

void

Implementation of

CameraManager.enabled

Defined in

packages/camera-manager/src/DefaultCameraManager.ts:151


keyboardNavigationEnabled

get keyboardNavigationEnabled(): boolean

Whether keyboard control of the camera is enabled/disabled.

Returns

boolean

Defined in

packages/camera-manager/src/DefaultCameraManager.ts:192

set keyboardNavigationEnabled(enabled): void

Sets whether keyboard control of the camera is enabled/disabled.

Parameters

NameType
enabledboolean

Returns

void

Defined in

packages/camera-manager/src/DefaultCameraManager.ts:185

Methods

dispose

dispose(): void

Returns

void

Implementation of

CameraManager.dispose

Defined in

packages/camera-manager/src/DefaultCameraManager.ts:262


fitCameraToBoundingBox

fitCameraToBoundingBox(box, duration?, radiusFactor?): void

Moves camera to a place where the content of a bounding box is visible to the camera.

Parameters

NameTypeDefault value
boxBox3undefined
duration?numberundefined
radiusFactornumber2

Returns

void

Implementation of

CameraManager.fitCameraToBoundingBox

Defined in

packages/camera-manager/src/DefaultCameraManager.ts:133


getCamera

getCamera(): PerspectiveCamera

Returns the camera used for rendering in Cognite3DViewer. Note that the camera will not be modified directly by Reveal. Implementations must trigger the cameraChange-event whenever the camera changes.

Returns

PerspectiveCamera

Implementation of

CameraManager.getCamera

Defined in

packages/camera-manager/src/DefaultCameraManager.ts:196


getCameraControlsOptions

getCameraControlsOptions(): CameraControlsOptions

Gets current camera controls options.

Returns

CameraControlsOptions

Defined in

packages/camera-manager/src/DefaultCameraManager.ts:237


getCameraState

getCameraState(): Required<CameraState>

Get camera's state

Returns

Required<CameraState>

Implementation of

CameraManager.getCameraState

Defined in

packages/camera-manager/src/DefaultCameraManager.ts:226


off

off(event, callback): void

Unsubscribes from changes of the camera event.

Parameters

NameType
event"cameraChange"
callbackCameraChangeDelegate

Returns

void

Implementation of

CameraManager.off

Defined in

packages/camera-manager/src/DefaultCameraManager.ts:123


on

on(event, callback): void

Subscribes to changes of the camera event. This is used by Reveal to react on changes of the camera.

Parameters

NameType
event"cameraChange"
callbackCameraChangeDelegate

Returns

void

Implementation of

CameraManager.on

Defined in

packages/camera-manager/src/DefaultCameraManager.ts:113


setCameraControlsOptions

setCameraControlsOptions(controlsOptions): void

Sets camera controls options to customize camera controls modes. See CameraControlsOptions.

Parameters

NameTypeDescription
controlsOptionsCameraControlsOptionsJSON object with camera controls options.

Returns

void

Defined in

packages/camera-manager/src/DefaultCameraManager.ts:245


setCameraState

setCameraState(state): void

Sets camera state. All parameters are optional. Rotation and target can't be set at the same time, if so, error will be thrown. Set rotation is preserved until next call of setCameraState with empty rotation field.

Parameters

NameTypeDescription
stateCameraStateCamera state.

Returns

void

Implementation of

CameraManager.setCameraState

Defined in

packages/camera-manager/src/DefaultCameraManager.ts:206


update

update(deltaTime, boundingBox): void

Updates internal state of camera manager. Expected to update visual state of the camera as well as it's near and far planes if needed. Called in requestAnimationFrame-loop. Reveal performance affects frequency with which this method is called.

Parameters

NameType
deltaTimenumber
boundingBoxBox3

Returns

void

Implementation of

CameraManager.update

Defined in

packages/camera-manager/src/DefaultCameraManager.ts:252