PerspectiveCamera

PerspectiveCamera

Uses camera sensors and joystick input to provide a first-person VR experience.
Behaves like a first-person camera in computer games (i.e. has no roll).

Extends

Members

active :boolean

Inherited From:

Camera activity state.

Type:
  • boolean

interaction :CameraInteraction

See:

Camera interaction.

Type:

name :string

Inherited From:

Camera name.

Type:
  • string

pose :PerspectiveCameraPose

Camera pose. Updates automatically.

Type:

Methods

(async) activate()

Inherited From:

Activates the camera.

(async) disableHmdMode()

Inherited From:

Switches to regular rendering mode for handheld devices.

(async) disableSceneInteraction()

Turns off touch interaction with scene nodes. When off, touches only affect camera pose.

(async) enableHmdMode()

Inherited From:

Switches to stereoscopic rendering mode for use in HMDs.

(async) enableSceneInteraction()

Turns on touch interaction with scene nodes.

(async) getColorsAtWorldPositions(positions, radiusnullable) → {Array.<ColorRgb>}

Inherited From:

Get average camera colors at given world positions within a radius.

Parameters:
Name Type Attributes Default Description
positions Array.<Vector3d>

a list of 3d world space coordinates.

radius number <nullable>
10

radius in pixels to average colors around a position.

Returns:

list of colors at the positions

Type
Array.<ColorRgb>

(async) getPoseInViewingDirection(distance, projectToFloornullable) → {Vector3d}

Inherited From:

Calculates a point in the 3d space in front of the camera at a specified distance and returns its pose assigning the camera’s orientation.
The distance is measured horizontally starting from the camera position and is not related to the camera orientation (angle).

Parameters:
Name Type Attributes Default Description
distance number

distance from camera

projectToFloor boolean <nullable>
false

if true, projects the resulting point onto the xz plane

Returns:

resulting position

Type
Vector3d

(async) lookAtSceneCenter()

Turns camera towards the center of the current scene with respect to all visible scene objects.

(async) setBackgroundMaterial(materialId)

Sets the background material to a specific material id. This can only be done once.

Parameters:
Name Type Description
materialId string

(async) setInteraction(newInteraction)

Sets camera interaction.

Parameters:
Name Type Description
newInteraction CameraInteraction

(async) setPose(newPose)

Sets camera pose.

Parameters:
Name Type Description
newPose PerspectiveCameraPose

(async) zoomToFit()

Turns and moves the camera so that all visible scene objects are in the viewport.