Class WebXRMotionControllerManager
Constructors
constructor
-
Returns WebXRMotionControllerManager
Properties
StaticBase Repository Url
The base URL of the online controller repository. Can be changed at any time.
StaticDisable Controller Cache
Disable the controller cache and load the models each time a new WebXRProfileMotionController is loaded. Defaults to true.
StaticPrioritize Online Repository
Which repository gets priority - local or online
StaticUse Online Repository
Use the online repository, or use only locally-defined controllers
Methods
StaticClear Controller Cache
-
Clear the controller's cache (usually happens at the end of a session)
Returns void
StaticClear Profiles Cache
-
Clear the cache used for profile loading and reload when requested again
Returns void
StaticDefault Fallbacks
-
Register the default fallbacks. This function is called automatically when this file is imported.
Returns void
StaticFind Fallback With Profile Id
-
Find a fallback profile if the profile was not found. There are a few predefined generic profiles.
Parameters
- profileId: string
the profile to which a fallback needs to be found
Returns string[]
an array with corresponding fallback profiles
- profileId: string
StaticGet Motion Controller With XR Input
-
GetMotionControllerWithXRInput(
xrInput: XRInputSource,
scene: Scene,
forceProfile?: string,
): Promise<WebXRAbstractMotionController>When acquiring a new xrInput object (usually by the WebXRInput class), match it with the correct profile. The order of search:
- Iterate the profiles array of the xr input and try finding a corresponding motion controller
- (If not found) search in the gamepad id and try using it (legacy versions only)
- search for registered fallbacks (should be redundant, nonetheless it makes sense to check)
- return the generic trigger controller if none were found
Parameters
- xrInput: XRInputSource
the xrInput to which a new controller is initialized
- scene: Scene
the scene to which the model will be added
OptionalforceProfile: stringforce 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
StaticRegister Controller
-
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.
Parameters
- type: string
the profile type to register
- constructFunction: MotionControllerConstructor
the function to be called when loading this profile
Returns void
- type: string
StaticRegister Fallbacks For Profile Id
-
Register a fallback to a specific profile.
Parameters
- profileId: string
the profileId that will receive the fallbacks
- fallbacks: string[]
A list of fallback profiles
Returns void
- profileId: string
StaticUpdate Profiles List
-
Will update the list of profiles available in the repository
Returns Promise<{ [profile: string]: string }>
a promise that resolves to a map of profiles available online
Motion controller manager is managing the different webxr profiles and makes sure the right controller is being loaded.