Class WebXRGenericTriggerMotionController
Hierarchy (View Summary)
- WebXRAbstractMotionController
- WebXRGenericTriggerMotionController
Constructors
constructor
-
new WebXRGenericTriggerMotionController(
scene: Scene,
gamepadObject: IMinimalMotionControllerObject,
handedness: MotionControllerHandedness,
): WebXRGenericTriggerMotionControllerParameters
- scene: Scene
- gamepadObject: IMinimalMotionControllerObject
- handedness: MotionControllerHandedness
Returns WebXRGenericTriggerMotionController
Properties
Readonlycomponents
A map of components (WebXRControllerComponent) in this motion controller Components have a ComponentType and can also have both button and axis definitions
disable Animation
Disable the model's animation. Can be set at any time.
gamepad Object
The gamepad object correlating to this controller
handedness
handedness (left/right/none) of this controller
on Model Loaded Observable
Observers registered here will be triggered when the model of this controller is done loading
profile Id
The profile id of this motion controller
root Mesh
The root mesh of the model. It is null if the model was not yet initialized
StaticProfile Id
Static version of the profile id of this controller
Accessors
handness
-
Backwards compatibility due to a deeply-integrated typo
Returns MotionControllerHandedness
Methods
dispose
-
Dispose this controller, the model mesh and all its components
Returns void
get All Components Of Type
-
Returns all components of specific type
Parameters
- type: MotionControllerComponentType
the type to search for
Returns WebXRControllerComponent[]
an array of components with this type
- type: MotionControllerComponentType
get Component
-
get a component based an its component id as defined in layout.components
Parameters
- id: string
the id of the component
Returns WebXRControllerComponent
the component correlates to the id or undefined if not found
- id: string
get Component Ids
-
Get the list of components available in this motion controller
Returns string[]
an array of strings correlating to available components
get Component Of Type
-
Get the first component of specific type
Parameters
- type: MotionControllerComponentType
type of component to find
Returns Nullable<WebXRControllerComponent>
a controller component or null if not found
- type: MotionControllerComponentType
get Haptic Effects
-
Gets the haptic effects reported as supported by an actuator. See https://playground.babylonjs.com/#ULVR1X#0 for an interactive example.
Parameters
- hapticActuatorIndex: number = 0
index of the actuator (usually 0)
Returns readonly GamepadHapticEffectType[]
the effects reported by the actuator, or an empty array when effect discovery is unavailable
- hapticActuatorIndex: number = 0
get Main Component
-
Get the main (Select) component of this controller as defined in the layout
Returns WebXRControllerComponent
the main component of this controller
load Model
-
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
play Haptic Effect Async
-
playHapticEffectAsync(
effectType: GamepadHapticEffectType,
parameters?: GamepadEffectParameters,
hapticActuatorIndex?: number,
): Promise<GamepadHapticsResult>Plays an advanced haptic effect on this controller.
Parameters
- effectType: GamepadHapticEffectType
the standard Gamepad haptic effect to play
Optionalparameters: GamepadEffectParameterseffect duration, delay, and motor magnitudes
- hapticActuatorIndex: number = 0
index of the actuator (usually 0)
Returns Promise<GamepadHapticsResult>
the native completion result from the actuator
- effectType: GamepadHapticEffectType
pulse
Parameters
- value: number
the strength of the pulse in 0.0...1.0 range
- duration: number
Duration of the pulse in milliseconds
- hapticActuatorIndex: number = 0
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
reset Haptic Actuator Async
-
Stops the active haptic effect on an actuator.
Parameters
- hapticActuatorIndex: number = 0
index of the actuator (usually 0)
Returns Promise<GamepadHapticsResult>
the native completion result from the actuator
- hapticActuatorIndex: number = 0
update From XR Frame
-
Update this model using the current XRFrame
Parameters
- xrFrame: XRFrame
the current xr frame to use and update the model
Returns void
- xrFrame: XRFrame
A generic trigger-only motion controller for WebXR