• Public
  • Public/Protected
  • All

Class WebXRAbstractMotionController Abstract

An Abstract Motion controller This class receives an xrInput and a profile layout and uses those to initialize the components Each component has an observable to check for changes in value and state





  • constructs a new abstract motion controller


    • scene: Scene

      the scene to which the model of the controller will be added

    • layout: IMotionControllerLayout

      The profile layout to load

    • gamepadObject: IMinimalMotionControllerObject

      The gamepad object correlating to this controller

    • handedness: MotionControllerHandedness

      handedness (left/right/none) of this controller

    • Optional _doNotLoadControllerMesh: boolean

      set this flag to ignore the mesh loading

    • Optional _controllerCache: { filename: string; meshes: AbstractMesh[]; path: string }[]

      a cache holding controller models already loaded in this session

    Returns WebXRAbstractMotionController


components: {}

A map of components (WebXRControllerComponent) in this motion controller Components have a ComponentType and can also have both button and axis definitions

Type declaration

disableAnimation: boolean

Disable the model's animation. Can be set at any time.

The gamepad object correlating to this controller

handedness (left/right/none) of this controller

onModelLoadedObservable: Observable<WebXRAbstractMotionController>

Observers registered here will be triggered when the model of this controller is done loading

profileId: string

The profile id of this motion controller

The root mesh of the model. It is null if the model was not yet initialized


  • Backwards compatibility due to a deeply-integrated typo

    Returns MotionControllerHandedness


  • dispose(): void
  • Dispose this controller, the model mesh and all its components

    Returns void

  • get a component based an its component id as defined in layout.components


    • id: string

      the id of the component

    Returns WebXRControllerComponent

    the component correlates to the id or undefined if not found

  • getComponentIds(): string[]
  • Get the list of components available in this motion controller

    Returns string[]

    an array of strings correlating to available components

  • Get the main (Select) component of this controller as defined in the layout

    Returns WebXRControllerComponent

    the main component of this controller

  • loadModel(): Promise<boolean>
  • Loads the model correlating to this controller When the mesh is loaded, the onModelLoadedObservable will be triggered

    Returns Promise<boolean>

    A promise fulfilled with the result of the model loading

  • pulse(value: number, duration: number, hapticActuatorIndex?: number): Promise<boolean>
Pulse (vibrate) this controller If the controller does not support pulses, this function will fail silently and return Promise directly after called Consecutive calls to this function will cancel the last pulse call


  • value: number

    the strength of the pulse in 0.0...1.0 range

  • duration: number

    Duration of the pulse in milliseconds

  • Optional hapticActuatorIndex: number

    optional index of actuator (will usually be 0)

Returns Promise<boolean>

a promise that will send true when the pulse has ended and false if the device doesn't support pulse or an error accrued

  • updateFromXRFrame(xrFrame: XRFrame): void
  • Update this model using the current XRFrame


    • xrFrame: XRFrame

      the current xr frame to use and update the model

    Returns void


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