Options
All
  • Public
  • Public/Protected
  • All
Menu

Class WindowsMotionController

Defines the WindowsMotionController object that the state of the windows motion controller

Hierarchy

Implements

Index

Constructors

constructor

  • Creates a new WindowsMotionController from a gamepad

    Parameters

    • vrGamepad: any

      the gamepad that the controller should be created from

    Returns WindowsMotionController

Properties

browserGamepadSearch playground for browserGamepad

browserGamepad: any

The browser gamepad

controllerTypeSearch playground for controllerType

The type of controller (Eg. Windows mixed reality)

devicePositionSearch playground for devicePosition

devicePosition: Vector3

The device position in babylon space

deviceRotationQuaternionSearch playground for deviceRotationQuaternion

deviceRotationQuaternion: Quaternion

The device rotation in babylon space

deviceScaleFactorSearch playground for deviceScaleFactor

deviceScaleFactor: number

The scale factor of the device in babylon space

handSearch playground for hand

hand: string

idSearch playground for id

id: string

The id of the gamepad

indexSearch playground for index

index: number

The index of the gamepad

isXRSearch playground for isXR

isXR: boolean

If the controller is used in a webXR session

onMainButtonStateChangedObservableSearch playground for onMainButtonStateChangedObservable

onMainButtonStateChangedObservable: Observable<ExtendedGamepadButton>

Fired when the main button state has changed

onPadStateChangedObservableSearch playground for onPadStateChangedObservable

onPadStateChangedObservable: Observable<ExtendedGamepadButton>

Fired when the pad state has changed

onPadValuesChangedObservableSearch playground for onPadValuesChangedObservable

onPadValuesChangedObservable: Observable<StickValues>

Fired when controllers stick values have changed

onSecondaryButtonStateChangedObservableSearch playground for onSecondaryButtonStateChangedObservable

onSecondaryButtonStateChangedObservable: Observable<ExtendedGamepadButton>

Fired when the secondary button state has changed

onTrackpadChangedObservableSearch playground for onTrackpadChangedObservable

onTrackpadChangedObservable: Observable<ExtendedGamepadButton>

Fired when the trackpad on this controller is clicked

onTrackpadValuesChangedObservableSearch playground for onTrackpadValuesChangedObservable

onTrackpadValuesChangedObservable: Observable<StickValues>

Fired when the trackpad on this controller is modified

onTriggerStateChangedObservableSearch playground for onTriggerStateChangedObservable

onTriggerStateChangedObservable: Observable<ExtendedGamepadButton>

Fired when the trigger state has changed

padSearch playground for pad

X and Y axis corresponding to the controllers joystick

positionSearch playground for position

position: Vector3

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

rawPoseSearch playground for rawPose

rawPose: DevicePose

The raw pose from the device

rotationQuaternionSearch playground for rotationQuaternion

rotationQuaternion: Quaternion

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

trackpadSearch playground for trackpad

trackpad: StickValues

The current x and y values of this controller's trackpad

typeSearch playground for type

type: number

Specifies what type of gamepad this represents

Static DUALSHOCKSearch playground for DUALSHOCK

DUALSHOCK: number

Represents an Dual Shock controller

Static GAMEPADSearch playground for GAMEPAD

GAMEPAD: number

Represents a gamepad controller

Static Readonly GAMEPAD_ID_PREFIXSearch playground for GAMEPAD_ID_PREFIX

GAMEPAD_ID_PREFIX: string

The controller name prefix for this controller type

Static GENERICSearch playground for GENERIC

GENERIC: number

Represents a generic controller

Static MODEL_BASE_URLSearch playground for MODEL_BASE_URL

MODEL_BASE_URL: string

The base url used to load the left and right controller models

Static MODEL_LEFT_FILENAMESearch playground for MODEL_LEFT_FILENAME

MODEL_LEFT_FILENAME: string

The name of the left controller model file

Static MODEL_RIGHT_FILENAMESearch playground for MODEL_RIGHT_FILENAME

MODEL_RIGHT_FILENAME: string

The name of the right controller model file

Static Readonly POINTING_POSESearch playground for POINTING_POSE

POINTING_POSE: "POINTING_POSE" = "POINTING_POSE"

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

Static POSE_ENABLEDSearch playground for POSE_ENABLED

POSE_ENABLED: number

Represents a pose-enabled controller

Static XBOXSearch playground for XBOX

XBOX: number

Represents an XBox controller

Accessors

defaultModel

isConnected

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

    Returns boolean

leftStick

mesh

onGripButtonStateChangedObservable

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

    Returns Observable<ExtendedGamepadButton>

onMenuButtonStateChangedObservable

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

    Returns Observable<ExtendedGamepadButton>

onThumbstickButtonStateChangedObservable

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

    Returns Observable<ExtendedGamepadButton>

onTouchpadButtonStateChangedObservable

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

    Returns Observable<ExtendedGamepadButton>

onTouchpadValuesChangedObservable

  • Fired when the touchpad values on this controller are modified

    Returns Observable<StickValues>

onTriggerButtonStateChangedObservable

  • get onTriggerButtonStateChangedObservable(): Observable<ExtendedGamepadButton>
  • Fired when the trigger on this controller is modified

    Returns Observable<ExtendedGamepadButton>

rightStick

Methods

attachToMeshSearch playground for attachToMesh

attachToPoseControlledCameraSearch playground for attachToPoseControlledCamera

disposeSearch playground for dispose

  • dispose(): void

getForwardRaySearch playground for getForwardRay

  • 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

initControllerMeshSearch playground for initControllerMesh

  • initControllerMesh(scene: Scene, meshLoaded?: (mesh: AbstractMesh) => void, forceDefault?: boolean): void
  • 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.

    • Optional forceDefault: boolean

    Returns void

onButtonStateChangeSearch playground for onButtonStateChange

  • 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

onleftstickchangedSearch playground for onleftstickchanged

  • onleftstickchanged(callback: (values: StickValues) => void): void

onrightstickchangedSearch playground for onrightstickchanged

  • onrightstickchanged(callback: (values: StickValues) => void): void

updateSearch playground for update

  • update(): void
  • Called once per frame by the engine.

    Returns void

updateFromDeviceSearch playground for updateFromDevice

Legend

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