Skip to main content
Version: Next

Class: CameraManagerHelper

Defined in: packages/camera-manager/src/CameraManagerHelper.ts:24

Helper methods for implementing a camera manager.

Constructors​

Constructor​

new CameraManagerHelper(): CameraManagerHelper

Returns​

CameraManagerHelper

Methods​

updateCameraNearAndFar()​

updateCameraNearAndFar(camera, boundingBox): void

Defined in: packages/camera-manager/src/CameraManagerHelper.ts:133

Updates near and far plane of the camera based on the bounding box.

Parameters​

camera​

PerspectiveCamera

Used camera instance.

boundingBox​

Box3

Bounding box of all objects on the scene.

Returns​

void


calculateCameraStateToFitBoundingBox()​

static calculateCameraStateToFitBoundingBox(camera, boundingBox, radiusFactor?): object

Defined in: packages/camera-manager/src/CameraManagerHelper.ts:149

Calculates camera position and target that allows to see the content of provided bounding box.

Parameters​

camera​

PerspectiveCamera

Used camera instance.

boundingBox​

Box3

Bounding box to be fitted.

radiusFactor?​

number = 2

The ratio of the distance from camera to center of box and radius of the box.

Returns​

object

position​

position: Vector3

target​

target: Vector3


calculateNewRotationFromTarget()​

static calculateNewRotationFromTarget(camera, newTarget): Quaternion

Defined in: packages/camera-manager/src/CameraManagerHelper.ts:108

Calculates camera rotation from target

Parameters​

camera​

PerspectiveCamera

Used Camera instance

newTarget​

Vector3

The target to compute rotation from

Returns​

Quaternion

New camera rotationg


calculateNewTargetFromRotation()​

static calculateNewTargetFromRotation(camera, rotation, currentTarget, position): Vector3

Defined in: packages/camera-manager/src/CameraManagerHelper.ts:81

Calculates camera target based on new camera rotation.

Parameters​

camera​

PerspectiveCamera

Used camera instance.

rotation​

Quaternion

New camera rotation in quaternion form.

currentTarget​

Vector3

Current camera target.

position​

Vector3

New camera position.

Returns​

Vector3


updateCameraNearAndFar()​

static updateCameraNearAndFar(camera, boundingBox): void

Defined in: packages/camera-manager/src/CameraManagerHelper.ts:119

Updates near and far plane of the camera based on the bounding box.

Parameters​

camera​

PerspectiveCamera

Used camera instance.

boundingBox​

Box3

Bounding box of all objects on the scene.

Returns​

void

Deprecated​

use instance method instead