VrCamera

VrCamera

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

gyroscopeActive :bool

See:

Is the gyroscope enabled or disabled.

Type:
  • bool

name :string

Inherited From:

Camera name.

Type:
  • string

pose :ControllableCameraPose

Camera pose. Updates automatically.

Type:

pose :ControllableCameraPose

Camera pose. Updates automatically.

Type:

Methods

(async) activate()

Inherited From:

Activates the camera.

(async) disableGyroscope()

Disables the gyroscope for this camera.

(async) disableHmdMode()

Inherited From:

Switches to regular rendering mode for handheld devices.

(async) enableGyroscope()

Enables the gyroscope for this camera.

(async) enableHmdMode()

Inherited From:

Switches to stereoscopic rendering mode for use in HMDs.

(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

rotate(controllerInputVector)

Rotates the camera using joystick input

Parameters:
Name Type Description
controllerInputVector Vector3d

joystick axis values

translate(controllerInputVector)

Translates the camera using joystick input

Parameters:
Name Type Description
controllerInputVector Vector3d

joystick axis values