API

Interface IWebXRControllerHapticActuator

The haptic capabilities exposed by a WebXR motion controller actuator.

interface IWebXRControllerHapticActuator {
    effects?: readonly GamepadHapticEffectType[];
    playEffect?: (
        type: GamepadHapticEffectType,
        params?: GamepadEffectParameters,
    ) => Promise<GamepadHapticsResult>;
    reset?: () => Promise<GamepadHapticsResult>;
}
Index
effects?: readonly GamepadHapticEffectType[]

The haptic effects reported as supported by this actuator.

playEffect?: (
    type: GamepadHapticEffectType,
    params?: GamepadEffectParameters,
) => Promise<GamepadHapticsResult>

Plays a haptic effect, when advanced haptic playback is supported.

Type Declaration

    • (
          type: GamepadHapticEffectType,
          params?: GamepadEffectParameters,
      ): Promise<GamepadHapticsResult>
    • The playEffect() method of the GamepadHapticActuator interface causes the hardware to play a specific vibration effect.

      MDN Reference

      Parameters

      • type: GamepadHapticEffectType
      • Optionalparams: GamepadEffectParameters

      Returns Promise<GamepadHapticsResult>

reset?: () => Promise<GamepadHapticsResult>

Stops the active haptic effect, when reset is supported.

Type Declaration

    • (): Promise<GamepadHapticsResult>
    • The reset() method of the GamepadHapticActuator interface stops the hardware from playing an active vibration effect.

      MDN Reference

      Returns Promise<GamepadHapticsResult>