Class OpenXRInput
OpenXR Input related functionality.
Inherited Members
Namespace: UnityEngine.XR.OpenXR.Input
Assembly: solution.dll
Syntax
public static class OpenXRInput
Methods
GetActionHandle(InputAction, InputDevice)
Returns the OpenXR action handle for the given input action
Declaration
public static ulong GetActionHandle(InputAction inputAction, InputDevice inputDevice = null)
Parameters
Type | Name | Description |
---|---|---|
InputAction | inputAction | Source InputAction |
InputDevice | inputDevice | Optional InputDevice to filter by |
Returns
Type | Description |
---|---|
ulong | OpenXR handle that is associated with the given InputAction or 0 if not found |
GetActionIsActive(InputAction)
Return the active state of the given action
Declaration
public static bool GetActionIsActive(InputAction inputAction)
Parameters
Type | Name | Description |
---|---|---|
InputAction | inputAction | Input Action |
Returns
Type | Description |
---|---|
bool | True if the given action has any bindings that are active |
SendHapticImpulse(InputAction, float, float, float, InputDevice)
Send a haptic impulse using the given action
Declaration
public static void SendHapticImpulse(InputAction action, float amplitude, float frequency, float duration, InputDevice inputDevice = null)
Parameters
Type | Name | Description |
---|---|---|
InputAction | action | Action to send haptic impulse through |
float | amplitude | Amplitude of the impulse [0-1] |
float | frequency | Frequency of the impulse in hertz (Hz). (Typical frequency values are between 0 and 300Hz) (0 = default). Note that not all runtimes support frequency. |
float | duration | Duration of the impulse [0-] |
InputDevice | inputDevice | Optional device to limit haptic impulse to |
SendHapticImpulse(InputAction, float, float, InputDevice)
Send a haptic impulse using the given action
Declaration
public static void SendHapticImpulse(InputAction action, float amplitude, float duration, InputDevice inputDevice = null)
Parameters
Type | Name | Description |
---|---|---|
InputAction | action | Action to send haptic impulse through |
float | amplitude | Amplitude of the impulse [0-1] |
float | duration | Duration of the impulse [0-] |
InputDevice | inputDevice | Optional device to limit haptic impulse to |
SendHapticImpulse(InputActionReference, float, float, float, InputDevice)
Send a haptic impulse using an action reference
Declaration
public static void SendHapticImpulse(InputActionReference actionRef, float amplitude, float frequency, float duration, InputDevice inputDevice = null)
Parameters
Type | Name | Description |
---|---|---|
InputActionReference | actionRef | Action Reference to send haptic impulse through |
float | amplitude | Amplitude of the impulse [0-1] |
float | frequency | Frequency of the impulse in hertz (Hz). (Typical frequency values are between 0 and 300Hz) (0 = default). Note that not all runtimes support frequency. |
float | duration | Duration of the impulse [0-] |
InputDevice | inputDevice | Optional device to limit haptic impulse to |
SendHapticImpulse(InputActionReference, float, float, InputDevice)
Send a haptic impulse using an action reference
Declaration
public static void SendHapticImpulse(InputActionReference actionRef, float amplitude, float duration, InputDevice inputDevice = null)
Parameters
Type | Name | Description |
---|---|---|
InputActionReference | actionRef | Action Reference to send haptic impulse through |
float | amplitude | Amplitude of the impulse [0-1] |
float | duration | Duration of the impulse [0-] |
InputDevice | inputDevice | Optional device to limit haptic impulse to |
StopHaptics(InputAction, InputDevice)
Stop any haptics playing for the given action
Declaration
public static void StopHaptics(InputAction inputAction, InputDevice inputDevice = null)
Parameters
Type | Name | Description |
---|---|---|
InputAction | inputAction | Input action to stop haptics for |
InputDevice | inputDevice | Optional device filter for actions bound to multiple defices |
StopHaptics(InputActionReference, InputDevice)
Stop any haptics playing for the given action reference
Declaration
public static void StopHaptics(InputActionReference actionRef, InputDevice inputDevice = null)
Parameters
Type | Name | Description |
---|---|---|
InputActionReference | actionRef | Action reference to stop the haptics on. |
InputDevice | inputDevice | Optional device filter for actions bound to multiple devices. |
TryGetInputSourceName(InputAction, int, out string, InputSourceNameFlags, InputDevice)
Return the name of the input source bound to the given action
Declaration
public static bool TryGetInputSourceName(InputAction inputAction, int index, out string name, OpenXRInput.InputSourceNameFlags flags = InputSourceNameFlags.All, InputDevice inputDevice = null)
Parameters
Type | Name | Description |
---|---|---|
InputAction | inputAction | Input Action |
int | index | Index of the input source in the case of multiple bindings. |
string | name | Name of the input source if an input source was found or an empty string if none was found |
OpenXRInput.InputSourceNameFlags | flags | Flags that indicate which parts of the input source name are requested. |
InputDevice | inputDevice | Optional input device to limit search to |
Returns
Type | Description |
---|---|
bool | True if an input source was found |
TrySetControllerLateLatchAction(InputAction)
Set InputAction to be used for controller late latching (Vulkan Only Feature). Only support one inputAction for each left and right controller. See Controller Samples MarkLateLatchNode.cs for example code and usages.
Declaration
public static bool TrySetControllerLateLatchAction(InputAction inputAction)
Parameters
Type | Name | Description |
---|---|---|
InputAction | inputAction | Source InputAction - Pose Type |
Returns
Type | Description |
---|---|
bool | True if the given action is a valid pose action can be late latched |