interface PlayerVRAPI {
    deviceOrientationPermissionRequired(): boolean;
    disableGyroscope(): boolean;
    disableKeyboardControl(): boolean;
    disableMouseControl(): boolean;
    enableGyroscope(): boolean;
    enableKeyboardControl(): boolean;
    enableMouseControl(): boolean;
    getHorizontalFieldOfView(): number;
    getLastError(): string;
    getState(): string;
    getStereo(): boolean;
    getVerticalFieldOfView(): number;
    getViewingDirection(): ViewingDirection;
    getViewingDirectionChangeEventInterval(): number;
    getViewingDirectionChangeThreshold(): number;
    getZoom(): number;
    isGyroscopeEnabled(): boolean;
    isKeyboardControlEnabled(): boolean;
    isMouseControlEnabled(): boolean;
    moveViewingDirection(direction): boolean;
    requestDeviceOrientationPermission(): Promise<void>;
    setHorizontalFieldOfView(fieldOfView): boolean;
    setStereo(enableStereo): boolean;
    setVerticalFieldOfView(fieldOfView): boolean;
    setViewingDirection(viewingDirection): boolean;
    setViewingDirectionChangeEventInterval(interval): boolean;
    setViewingDirectionChangeThreshold(threshold): boolean;
    zoom(factor): boolean;
}

Methods

  • Returns true, if a permission is required to access device orientation data.

    Returns boolean

    True, if a permission is required, false otherwise.

  • Disables the gyroscope (also on VRHMDs).

    Returns boolean

    • True, if the VRHandler is ready, false otherwise.
  • Disables the keyboard controls.

    Returns boolean

    • True, if the VRHandler is ready, false otherwise.
  • Disables the mouse controls.

    Returns boolean

    • True, if the VRHandler is ready, false otherwise.
  • Enables the gyroscope (also on VRHMDs).

    Returns boolean

    • True, if the VRHandler is ready, false otherwise.
  • Enables the keyboard controls.

    Returns boolean

    • True, if the VRHandler is ready, false otherwise.
  • Enables the mouse controls.

    Returns boolean

    • True, if the VRHandler is ready, false otherwise.
  • Gets the horizontal field of view in degrees.

    Returns number

    • The horizontal field of view in degrees.
  • Returns the last recorded error or null, if no error occurred.

    Returns string

    • The last recorded error.
  • Returns the current state of the VR handler or null, if the VR handler is not yet initialized.

    Returns string

    • The current state of the VR handler.
  • Returns true, if stereo is enabled, false otherwise.

    Returns boolean

    • True, if stereo is enabled, false otherwise.
  • Gets the vertical field of view in degrees.

    Returns number

    • The vertical field of view in degrees.
  • Returns the current viewing direction, if the VRHandler is in the playing state.

    Returns ViewingDirection

    • The current viewing direction.
  • Gets the minimal interval between consecutive VRViewingDirectionChange events.

    Returns number

    • The minimal interval between consecutive VRViewingDirectionChange events.
  • Gets the number of degrees that the viewport can change before the VRViewingDirectionChange event is triggered.

    Returns number

    • The threshold in degrees that the viewport can change before the VRViewingDirectionChange event is triggered.
  • Returns the current zoom factor.

    Returns number

    • The current zoom factor, if the VRHandler is ready, -1 otherwise.
  • Returns true, if the gyroscope is enabled, false otherwise.

    Returns boolean

    • True, if the gyroscope is enabled, false otherwise.
  • Returns true, if keyboard controls are enabled, false otherwise.

    Returns boolean

    • True, if keyboard controls are enabled, false otherwise.
  • Returns true, if mouse controls are enabled, false otherwise.

    Returns boolean

    • True, if mouse controls are enabled, false otherwise.
  • Moves the current VR viewing direction in the given direction with the given speed. The speed is determined by the length of the direction vector in degrees / second. The movement will be continued for 110ms, after that period the movement will be dampened and fade out. To sustain a smooth viewport movement, no more than 100ms must pass between consecutive calls to this function.

    Parameters

    • direction: Vec3

      A three-component vector describing the direction and speed in which the viewing direction shall be moved.

    Returns boolean

    • True, if the VRHandler is ready, false otherwise.
  • Requests the permission needed to access device orientation data, if required.

    Returns Promise<void>

    A promise that resolves when the required permissions have been acquired.

  • Sets the horizontal field of view in degrees.

    Parameters

    • fieldOfView: number

      The horizontal field of view in degrees.

    Returns boolean

    • True, if the VRHandler is ready, false otherwise.
  • Enables or disables stereo mode for VR content.

    Parameters

    • enableStereo: boolean

      If true, stereo mode will be enabled.

    Returns boolean

    • True if API call was successful, false otherwise.
  • Sets the vertical field of view in degrees.

    Parameters

    • fieldOfView: number

      The vertical field of view in degrees.

    Returns boolean

    • True, if the VRHandler is ready, false otherwise.
  • Sets the given viewing direction, if the VRHandler is in the playing state.

    Parameters

    Returns boolean

    • True, if the viewing direction could be set, false otherwise.
  • Sets the minimal interval between consecutive VRViewingDirectionChange events. The default value is 250ms.

    Parameters

    • interval: number

      The minimal interval between consecutive VRViewingDirectionChange events.

    Returns boolean

    • True, if the VRHandler is ready, false otherwise.
  • Sets the number of degrees that the viewport can change before the VRViewingDirectionChange event is triggered. The default value is 5°.

    Parameters

    • threshold: number

      The threshold in degrees that the viewport can change before the VRViewingDirectionChange event is triggered.

    Returns boolean

    • True, if the VRHandler is ready, false otherwise.
  • Applies a zoom factor to the current field of view.

    Parameters

    • factor: number

      The zoom factor to apply.

    Returns boolean

    • True, if the VRHandler is ready, false otherwise.

Generated using TypeDoc