Guides
These docs are for v3.2.0. Click to read the latest docs for v3.3.0.

VRTK_ControllerHaptics

Overview

The Controller Haptics scripts are a collection of static methods for calling haptic functions on a given controller.

Class Methods

TriggerHapticPulse/2

public static void TriggerHapticPulse(VRTK_ControllerReference controllerReference, float strength)

  • Parameters
  • VRTK_ControllerReference controllerReference - The reference to the controller to activate the haptic feedback on.
  • float strength - The intensity of the rumble of the controller motor. 0 to 1.
  • Returns
  • none

The TriggerHapticPulse/2 method calls a single haptic pulse call on the controller for a single tick.

TriggerHapticPulse/4

public static void TriggerHapticPulse(VRTK_ControllerReference controllerReference, float strength, float duration, float pulseInterval)

  • Parameters
  • VRTK_ControllerReference controllerReference - The reference to the controller to activate the haptic feedback on.
  • float strength - The intensity of the rumble of the controller motor. 0 to 1.
  • float duration - The length of time the rumble should continue for.
  • float pulseInterval - The interval to wait between each haptic pulse.
  • Returns
  • none

The TriggerHapticPulse/4 method calls a haptic pulse for a specified amount of time rather than just a single tick. Each pulse can be separated by providing a pulseInterval to pause between each haptic pulse.

TriggerHapticPulse/2

public static void TriggerHapticPulse(VRTK_ControllerReference controllerReference, AudioClip clip)

  • Parameters
  • VRTK_ControllerReference controllerReference - The reference to the controller to activate the haptic feedback on.
  • AudioClip clip - The audio clip to use for the haptic pattern.
  • Returns
  • none

The TriggerHapticPulse/2 method calls a haptic pulse based on a given audio clip.

CancelHapticPulse/1

public static void CancelHapticPulse(VRTK_ControllerReference controllerReference)

  • Parameters
  • VRTK_ControllerReference controllerReference - The reference to the controller to cancel the haptic feedback on.
  • Returns
  • none

The CancelHapticPulse method cancels the existing running haptic pulse on the given controller index.