Class HapticsUtility
Haptics utilities. Provides methods for a convenient way to send a haptic impulse to the left, right, or both controllers using a static method call.
Inherited Members
Namespace: UnityEngine.XR.Interaction.Toolkit.Inputs.Haptics
Assembly: Unity.XR.Interaction.Toolkit.dll
Syntax
public static class HapticsUtility
Remarks
If you need more control over how the haptic impulse is sent, you should use the HapticImpulsePlayer with an object reference to a custom IXRHapticImpulseProvider.
Methods
SendHapticImpulse(float, float, Controller, float, int)
Sends a haptic impulse on the controller device if it supports sending a haptic impulse.
Declaration
public static bool SendHapticImpulse(float amplitude, float duration, HapticsUtility.Controller controller, float frequency = 0, int channel = 0)
Parameters
Type | Name | Description |
---|---|---|
float | amplitude | The desired motor amplitude that should be within a [0-1] range. |
float | duration | The desired duration of the impulse in seconds. |
HapticsUtility.Controller | controller | The controller to send the haptic impulse to. |
float | frequency | The desired frequency of the impulse in Hz. A value of 0 means to use the default frequency of the device. |
int | channel | The haptic channel of the device to send to, by index. |
Returns
Type | Description |
---|---|
bool |