The MotionController Manager manages all registered motion controllers and loads the right one when needed.

When this repository is complete: https://github.com/immersive-web/webxr-input-profiles/tree/master/packages/assets it should be replaced with auto-loaded controllers.

When using a model try to stay as generic as possible. Eventually there will be no need in any of the controller classes


  • WebXRMotionControllerManager



Static BaseRepositoryUrl

Find examples in Playground
BaseRepositoryUrl: string

The base URL of the online controller repository. Can be changed at any time.

Static PrioritizeOnlineRepository

Find examples in Playground
PrioritizeOnlineRepository: boolean

Which repository gets priority - local or online

Static UseOnlineRepository

Find examples in Playground
UseOnlineRepository: boolean

Use the online repository, or use only locally-defined controllers


Static ClearProfilesCache

Find examples in Playground
  • ClearProfilesCache(): void
  • Clear the cache used for profile loading and reload when requested again

    Returns void

Static DefaultFallbacks

Find examples in Playground
  • DefaultFallbacks(): void
  • Register the default fallbacks. This function is called automatically when this file is imported.

    Returns void

Static FindFallbackWithProfileId

Find examples in Playground
  • FindFallbackWithProfileId(profileId: string): string[]
  • Find a fallback profile if the profile was not found. There are a few predefined generic profiles.


    • profileId: string

      the profile to which a fallback needs to be found

    Returns string[]

    an array with corresponding fallback profiles

Static GetMotionControllerWithXRInput

Find examples in Playground
  • When acquiring a new xrInput object (usually by the WebXRInput class), match it with the correct profile. The order of search:

    1) Iterate the profiles array of the xr input and try finding a corresponding motion controller 2) (If not found) search in the gamepad id and try using it (legacy versions only) 3) search for registered fallbacks (should be redundant, nonetheless it makes sense to check) 4) return the generic trigger controller if none were found


    • xrInput: XRInputSource

      the xrInput to which a new controller is initialized

    • scene: Scene

      the scene to which the model will be added

    • Optional forceProfile: string

      force a certain profile for this controller

    Returns Promise<WebXRAbstractMotionController>

    A promise that fulfils with the motion controller class for this profile id or the generic standard class if none was found

Static RegisterController

Find examples in Playground
  • Register a new controller based on its profile. This function will be called by the controller classes themselves.

    If you are missing a profile, make sure it is imported in your source, otherwise it will not register.


    • type: string

      the profile type to register

    • constructFunction: MotionControllerConstructor

      the function to be called when loading this profile

    Returns void

Static RegisterFallbacksForProfileId

Find examples in Playground
  • RegisterFallbacksForProfileId(profileId: string, fallbacks: string[]): void
  • Register a fallback to a specific profile.


    • profileId: string

      the profileId that will receive the fallbacks

    • fallbacks: string[]

      A list of fallback profiles

    Returns void

Static UpdateProfilesList

Find examples in Playground
  • UpdateProfilesList(): Promise<object>
  • Will update the list of profiles available in the repository

    Returns Promise<object>

    a promise that resolves to a map of profiles available online

Generated using TypeDoc