Options
All
  • Public
  • Public/Protected
  • All
Menu

Vive Controller

Hierarchy

Index

Constructors

  • Creates a new ViveController from a gamepad

    Parameters

    • vrGamepad: any

      the gamepad that the controller should be created from

    Returns ViveController

Properties

browserGamepad: any

The browser gamepad

The type of controller (Eg. Windows mixed reality)

devicePosition: Vector3

The device position in babylon space

deviceRotationQuaternion: Quaternion

The device rotation in babylon space

deviceScaleFactor: number

The scale factor of the device in babylon space

hand: string
id: string

The id of the gamepad

index: number

The index of the gamepad

isXR: boolean

If the controller is used in a webXR session

onMainButtonStateChangedObservable: Observable<ExtendedGamepadButton>

Fired when the main button state has changed

onPadStateChangedObservable: Observable<ExtendedGamepadButton>

Fired when the pad state has changed

onPadValuesChangedObservable: Observable<StickValues>

Fired when controllers stick values have changed

onSecondaryButtonStateChangedObservable: Observable<ExtendedGamepadButton>

Fired when the secondary button state has changed

onTriggerStateChangedObservable: Observable<ExtendedGamepadButton>

Fired when the trigger state has changed

X and Y axis corresponding to the controllers joystick

position: Vector3

(Likely devicePosition should be used instead) The device position in its room space

rawPose: DevicePose

The raw pose from the device

rotationQuaternion: Quaternion

(Likely deviceRotationQuaternion should be used instead) The device rotation in its room space

type: number

Specifies what type of gamepad this represents

DUALSHOCK: number

Represents an Dual Shock controller

GAMEPAD: number

Represents a gamepad controller

GENERIC: number

Represents a generic controller

MODEL_BASE_URL: string

Base Url for the controller model.

MODEL_FILENAME: string

File name for the controller model.

POINTING_POSE: "POINTING_POSE" = "POINTING_POSE"

Name of the child mesh that can be used to cast a ray from the controller

POSE_ENABLED: number

Represents a pose-enabled controller

XBOX: number

Represents an XBox controller

Accessors

  • The default controller model for the controller

    Returns Nullable<AbstractMesh>

  • get isConnected(): boolean
  • Specifies if the gamepad has been connected

    Returns boolean

  • Gets the left joystick

    Returns StickValues

  • Sets the left joystick values

    Parameters

    Returns void

  • The mesh that is attached to the controller

    Returns Nullable<AbstractMesh>

  • get onLeftButtonStateChangedObservable(): Observable<ExtendedGamepadButton>
  • Fired when the left button on this controller is modified

    Returns Observable<ExtendedGamepadButton>

  • get onMenuButtonStateChangedObservable(): Observable<ExtendedGamepadButton>
  • Fired when the menu button on this controller is modified

    Returns Observable<ExtendedGamepadButton>

  • get onRightButtonStateChangedObservable(): Observable<ExtendedGamepadButton>
  • Fired when the right button on this controller is modified

    Returns Observable<ExtendedGamepadButton>

  • Gets the right joystick

    Returns StickValues

  • Sets the right joystick value

    Parameters

    Returns void

Methods

  • dispose(): void
  • Disposes of th webVRController

    Returns void

  • getForwardRay(length?: number): Ray
  • Gets the ray of the controller in the direction the controller is pointing

    Parameters

    • Optional length: number

      the length the resulting ray should be

    Returns Ray

    a ray in the direction the controller is pointing

  • Implements abstract method on WebVRController class, loading controller meshes and calling this.attachToMesh if successful.

    Parameters

    • scene: Scene

      scene in which to add meshes

    • Optional meshLoaded: (mesh: AbstractMesh) => void

      optional callback function that will be called if the mesh loads successfully.

    Returns void

  • onButtonStateChange(callback: (controlledIndex: number, buttonIndex: number, state: ExtendedGamepadButton) => void): void
  • Fired when a controller button's state has changed

    Parameters

    • callback: (controlledIndex: number, buttonIndex: number, state: ExtendedGamepadButton) => void

      the callback containing the button that was modified

        • (controlledIndex: number, buttonIndex: number, state: ExtendedGamepadButton): void
        • Parameters

          • controlledIndex: number
          • buttonIndex: number
          • state: ExtendedGamepadButton

          Returns void

    Returns void

  • onleftstickchanged(callback: (values: StickValues) => void): void
  • onrightstickchanged(callback: (values: StickValues) => void): void
  • update(): void
  • Updates the state of the controller and mesh based on the current position and rotation of the controller

    Returns void

  • Updates the state of the pose enbaled controller based on the raw pose data from the device

    Parameters

    Returns void

Legend

  • Inherited constructor
  • Inherited property
  • Inherited method
  • Inherited accessor
  • Constructor
  • Property
  • Method
  • Property
  • Method
  • Static property
  • Static method

Settings

Theme