docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    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.

    Inheritance
    object
    HapticsUtility
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    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

    Returns true if successful. Otherwise, returns false.

    In This Article
    Back to top
    Copyright © 2025 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)