#if OPENXR_1_6_OR_NEWER || PACKAGE_DOCS_GENERATION using UnityEngine.InputSystem; using UnityEngine.XR.OpenXR.Input; namespace UnityEngine.XR.Interaction.Toolkit.Inputs.Haptics.OpenXR { /// /// Allows for sending haptic impulses to a channel on a device specified by a haptic control. /// Only available when the OpenXR Plugin (com.unity.xr.openxr) package is installed. /// /// /// public class OpenXRHapticImpulseChannel : IXRHapticImpulseChannel { /// /// Action to send haptic impulse through. /// public InputAction hapticAction { get; set; } /// /// The input device to send the impulse to. /// public InputSystem.InputDevice device { get; set; } /// public bool SendHapticImpulse(float amplitude, float duration, float frequency) { #if OPENXR_1_7_OR_NEWER var actionHandle = OpenXRInput.GetActionHandle(hapticAction); if (actionHandle == 0L) return false; #endif OpenXRInput.SendHapticImpulse(hapticAction, amplitude, frequency, duration, device); return true; } } } #endif