WebVRController

Defines the WebVRController object that represents controllers tracked in 3D space

Hierarchy

Implements

Index

Constructors

constructor

Find examples in Playground

Properties

browserGamepad

Find examples in Playground
browserGamepad: any

The browser gamepad

controllerType

Find examples in Playground

The type of controller (Eg. Windows mixed reality)

devicePosition

Find examples in Playground
devicePosition: Vector3

The device position in babylon space

deviceRotationQuaternion

Find examples in Playground
deviceRotationQuaternion: Quaternion

The device rotation in babylon space

deviceScaleFactor

Find examples in Playground
deviceScaleFactor: number

The scale factor of the device in babylon space

hand

Find examples in Playground
hand: string

id

Find examples in Playground
id: string

The id of the gamepad

index

Find examples in Playground
index: number

The index of the gamepad

isXR

Find examples in Playground
isXR: boolean

If the controller is used in a webXR session

onMainButtonStateChangedObservable

Find examples in Playground
onMainButtonStateChangedObservable: Observable<ExtendedGamepadButton>

Fired when the main button state has changed

onPadStateChangedObservable

Find examples in Playground
onPadStateChangedObservable: Observable<ExtendedGamepadButton>

Fired when the pad state has changed

onPadValuesChangedObservable

Find examples in Playground
onPadValuesChangedObservable: Observable<StickValues>

Fired when controllers stick values have changed

onSecondaryButtonStateChangedObservable

Find examples in Playground
onSecondaryButtonStateChangedObservable: Observable<ExtendedGamepadButton>

Fired when the secondary button state has changed

onTriggerStateChangedObservable

Find examples in Playground
onTriggerStateChangedObservable: Observable<ExtendedGamepadButton>

Fired when the trigger state has changed

pad

Find examples in Playground

X and Y axis corresponding to the controllers joystick

position

Find examples in Playground
position: Vector3

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

rawPose

Find examples in Playground
rawPose: DevicePose

The raw pose from the device

rotationQuaternion

Find examples in Playground
rotationQuaternion: Quaternion

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

type

Find examples in Playground
type: number

Specifies what type of gamepad this represents

Static DUALSHOCK

Find examples in Playground
DUALSHOCK: number

Represents an Dual Shock controller

Static GAMEPAD

Find examples in Playground
GAMEPAD: number

Represents a gamepad controller

Static GENERIC

Find examples in Playground
GENERIC: number

Represents a generic controller

Static Readonly POINTING_POSE

Find examples in Playground
POINTING_POSE: string

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

Static POSE_ENABLED

Find examples in Playground
POSE_ENABLED: number

Represents a pose-enabled controller

Static XBOX

Find examples in Playground
XBOX: number

Represents an XBox controller

Accessors

defaultModel

Find examples in Playground

isConnected

Find examples in Playground
  • get isConnected(): boolean
  • Specifies if the gamepad has been connected

    Returns boolean

leftStick

Find examples in Playground

mesh

Find examples in Playground

rightStick

Find examples in Playground

Methods

attachToMesh

Find examples in Playground

attachToPoseControlledCamera

Find examples in Playground

dispose

Find examples in Playground
  • dispose(): void

getForwardRay

Find examples in Playground
  • 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

Abstract initControllerMesh

Find examples in Playground
  • initControllerMesh(scene: Scene, meshLoaded?: function): void
  • Loads a mesh and attaches it to the controller

    Parameters

    • scene: Scene

      the scene the mesh should be added to

    • Optional meshLoaded: function

      callback for when the mesh has been loaded

    Returns void

onButtonStateChange

Find examples in Playground
  • onButtonStateChange(callback: function): void
  • Fired when a controller button's state has changed

    Parameters

    • callback: function

      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

Find examples in Playground
  • onleftstickchanged(callback: function): void

onrightstickchanged

Find examples in Playground
  • onrightstickchanged(callback: function): void

update

Find examples in Playground
  • update(): void
  • Updates the state of the controller and mesh based on the current position and rotation of the controller

    Returns void

updateFromDevice

Find examples in Playground

Generated using TypeDoc