786 lines
37 KiB
C#
786 lines
37 KiB
C#
using System.Collections.Generic;
|
|
using UnityEngine.InputSystem.Controls;
|
|
using UnityEngine.InputSystem.Layouts;
|
|
using UnityEngine.InputSystem.XR;
|
|
using UnityEngine.Scripting;
|
|
using UnityEngine.XR.OpenXR.Input;
|
|
|
|
#if UNITY_EDITOR
|
|
using UnityEditor;
|
|
#endif
|
|
|
|
#if USE_INPUT_SYSTEM_POSE_CONTROL
|
|
using PoseControl = UnityEngine.InputSystem.XR.PoseControl;
|
|
#else
|
|
using PoseControl = UnityEngine.XR.OpenXR.Input.PoseControl;
|
|
#endif
|
|
|
|
#if USE_STICK_CONTROL_THUMBSTICKS
|
|
using ThumbstickControl = UnityEngine.InputSystem.Controls.StickControl; // If replaced, make sure the control extends Vector2Control
|
|
#else
|
|
using ThumbstickControl = UnityEngine.InputSystem.Controls.Vector2Control;
|
|
#endif
|
|
|
|
namespace UnityEngine.XR.OpenXR.Features.Interactions
|
|
{
|
|
/// <summary>
|
|
/// This <see cref="OpenXRInteractionFeature"/> enables the use of Valve Index Controllers interaction profiles in OpenXR.
|
|
/// </summary>
|
|
#if UNITY_EDITOR
|
|
[UnityEditor.XR.OpenXR.Features.OpenXRFeature(UiName = "Valve Index Controller Profile",
|
|
BuildTargetGroups = new[] { BuildTargetGroup.Standalone, BuildTargetGroup.WSA },
|
|
Company = "Unity",
|
|
Desc = "Allows for mapping input to the Valve Index Controller interaction profile.",
|
|
DocumentationLink = Constants.k_DocumentationManualURL + "features/valveindexcontrollerprofile.html",
|
|
OpenxrExtensionStrings = "",
|
|
Version = "0.0.1",
|
|
Category = UnityEditor.XR.OpenXR.Features.FeatureCategory.Interaction,
|
|
FeatureId = featureId)]
|
|
#endif
|
|
public class ValveIndexControllerProfile : OpenXRInteractionFeature
|
|
{
|
|
/// <summary>
|
|
/// The feature id string. This is used to give the feature a well known id for reference.
|
|
/// </summary>
|
|
public const string featureId = "com.unity.openxr.feature.input.valveindex";
|
|
|
|
/// <summary>
|
|
/// An Input System device based on the hand interaction profile in the <a href="https://www.khronos.org/registry/OpenXR/specs/1.0/html/xrspec.html#_valve_index_controller_profile">Valve Index Controller</a>.
|
|
/// </summary>
|
|
[Preserve, InputControlLayout(displayName = "Index Controller (OpenXR)", commonUsages = new[] { "LeftHand", "RightHand" })]
|
|
public class ValveIndexController : XRControllerWithRumble
|
|
{
|
|
/// <summary>
|
|
/// A [ButtonControl](xref:UnityEngine.InputSystem.Controls.ButtonControl) that represents the <see cref="ValveIndexControllerProfile.system"/> OpenXR binding.
|
|
/// </summary>
|
|
[Preserve, InputControl(alias = "systemButton", usage = "MenuButton")]
|
|
public ButtonControl system { get; private set; }
|
|
|
|
/// <summary>
|
|
/// A [ButtonControl](xref:UnityEngine.InputSystem.Controls.ButtonControl) that represents the <see cref="ValveIndexControllerProfile.systemTouch"/> OpenXR binding.
|
|
/// </summary>
|
|
[Preserve, InputControl(usage = "MenuTouch")]
|
|
public ButtonControl systemTouched { get; private set; }
|
|
|
|
/// <summary>
|
|
/// A [ButtonControl](xref:UnityEngine.InputSystem.Controls.ButtonControl) that represents the <see cref="ValveIndexControllerProfile.buttonA"/> OpenXR binding.
|
|
/// </summary>
|
|
[Preserve, InputControl(usage = "PrimaryButton")]
|
|
public ButtonControl primaryButton { get; private set; }
|
|
|
|
/// <summary>
|
|
/// A [ButtonControl](xref:UnityEngine.InputSystem.Controls.ButtonControl) that represents the <see cref="ValveIndexControllerProfile.buttonATouch"/> OpenXR binding.
|
|
/// </summary>
|
|
[Preserve, InputControl(usage = "PrimaryTouch")]
|
|
public ButtonControl primaryTouched { get; private set; }
|
|
|
|
/// <summary>
|
|
/// A [ButtonControl](xref:UnityEngine.InputSystem.Controls.ButtonControl) that represents the <see cref="ValveIndexControllerProfile.buttonB"/> OpenXR binding.
|
|
/// </summary>
|
|
[Preserve, InputControl(usage = "SecondaryButton")]
|
|
public ButtonControl secondaryButton { get; private set; }
|
|
|
|
/// <summary>
|
|
/// A [ButtonControl](xref:UnityEngine.InputSystem.Controls.ButtonControl) that represents the <see cref="ValveIndexControllerProfile.buttonBTouch"/> OpenXR binding.
|
|
/// </summary>
|
|
[Preserve, InputControl(usage = "SecondaryTouch")]
|
|
public ButtonControl secondaryTouched { get; private set; }
|
|
|
|
/// <summary>
|
|
/// A [AxisControl](xref:UnityEngine.InputSystem.Controls.AxisControl) that represents the <see cref="ValveIndexControllerProfile.squeeze"/> OpenXR binding.
|
|
/// </summary>
|
|
[Preserve, InputControl(aliases = new[] { "GripAxis", "squeeze" }, usage = "Grip")]
|
|
public AxisControl grip { get; private set; }
|
|
|
|
/// <summary>
|
|
/// A [ButtonControl](xref:UnityEngine.InputSystem.Controls.ButtonControl) that represents the Valve Index Controller Profile gripPressed OpenXR binding.
|
|
/// </summary>
|
|
[Preserve, InputControl(aliases = new[] { "GripButton", "squeezeClicked" }, usage = "GripButton")]
|
|
public ButtonControl gripPressed { get; private set; }
|
|
|
|
/// <summary>
|
|
/// A [AxisControl](xref:UnityEngine.InputSystem.Controls.AxisControl) that represents the <see cref="ValveIndexControllerProfile.squeezeForce"/> OpenXR binding.
|
|
/// </summary>
|
|
[Preserve, InputControl(alias = "squeezeForce", usage = "GripForce")]
|
|
public AxisControl gripForce { get; private set; }
|
|
|
|
/// <summary>
|
|
/// A [AxisControl](xref:UnityEngine.InputSystem.Controls.AxisControl) that represents the <see cref="ValveIndexControllerProfile.trigger"/> OpenXR binding.
|
|
/// </summary>
|
|
[Preserve, InputControl(usage = "Trigger")]
|
|
public AxisControl trigger { get; private set; }
|
|
|
|
/// <summary>
|
|
/// A [ButtonControl](xref:UnityEngine.InputSystem.Controls.ButtonControl) that represents the <see cref="ValveIndexControllerProfile.triggerClick"/> OpenXR binding.
|
|
/// </summary>
|
|
[Preserve, InputControl(usage = "TriggerButton")]
|
|
public ButtonControl triggerPressed { get; private set; }
|
|
|
|
/// <summary>
|
|
/// A [ButtonControl](xref:UnityEngine.InputSystem.Controls.ButtonControl) that represents the <see cref="ValveIndexControllerProfile.triggerTouch"/> OpenXR binding.
|
|
/// </summary>
|
|
[Preserve, InputControl(usage = "TriggerTouch")]
|
|
public ButtonControl triggerTouched { get; private set; }
|
|
|
|
/// <summary>
|
|
/// A [Vector2Control](xref:UnityEngine.InputSystem.Controls.Vector2Control)/[StickControl](xref:UnityEngine.InputSystem.Controls.StickControl) that represents the <see cref="ValveIndexControllerProfile.thumbstick"/> OpenXR binding.
|
|
/// </summary>
|
|
[Preserve, InputControl(aliases = new[] { "joystick", "Primary2DAxis" }, usage = "Primary2DAxis")]
|
|
public ThumbstickControl thumbstick { get; private set; }
|
|
|
|
/// <summary>
|
|
/// A [ButtonControl](xref:UnityEngine.InputSystem.Controls.ButtonControl) that represents the <see cref="ValveIndexControllerProfile.thumbstickClick"/> OpenXR binding.
|
|
/// </summary>
|
|
[Preserve, InputControl(alias = "joystickClicked", usage = "Primary2DAxisClick")]
|
|
public ButtonControl thumbstickClicked { get; private set; }
|
|
|
|
/// <summary>
|
|
/// A [ButtonControl](xref:UnityEngine.InputSystem.Controls.ButtonControl) that represents the <see cref="ValveIndexControllerProfile.thumbstickTouch"/> OpenXR binding.
|
|
/// </summary>
|
|
[Preserve, InputControl(alias = "joystickTouched", usage = "Primary2DAxisTouch")]
|
|
public ButtonControl thumbstickTouched { get; private set; }
|
|
|
|
/// <summary>
|
|
/// A [Vector2Control](xref:UnityEngine.InputSystem.Controls.Vector2Control)/[StickControl](xref:UnityEngine.InputSystem.Controls.StickControl) that represents the <see cref="ValveIndexControllerProfile.trackpad"/> OpenXR binding.
|
|
/// </summary>
|
|
[Preserve, InputControl(aliases = new[] { "touchpad", "Secondary2DAxis" }, usage = "Secondary2DAxis")]
|
|
public ThumbstickControl trackpad { get; private set; }
|
|
|
|
/// <summary>
|
|
/// A [ButtonControl](xref:UnityEngine.InputSystem.Controls.ButtonControl) that represents the <see cref="ValveIndexControllerProfile.trackpadTouch"/> OpenXR binding.
|
|
/// </summary>
|
|
[Preserve, InputControl(alias = "touchpadTouched", usage = "Secondary2DAxisTouch")]
|
|
public ButtonControl trackpadTouched { get; private set; }
|
|
|
|
/// <summary>
|
|
/// A [AxisControl](xref:UnityEngine.InputSystem.Controls.AxisControl) that represents the <see cref="ValveIndexControllerProfile.trackpadForce"/> OpenXR binding.
|
|
/// </summary>
|
|
[Preserve, InputControl(alias = "touchpadForce", usage = "Secondary2DAxisForce")]
|
|
public AxisControl trackpadForce { get; private set; }
|
|
|
|
/// <summary>
|
|
/// A <see cref="PoseControl"/> that represents the <see cref="ValveIndexControllerProfile.grip"/> OpenXR binding.
|
|
/// </summary>
|
|
[Preserve, InputControl(offset = 0, aliases = new[] { "device", "gripPose" }, usage = "Device")]
|
|
public PoseControl devicePose { get; private set; }
|
|
|
|
/// <summary>
|
|
/// A <see cref="PoseControl"/> that represents the Valve Index Controller Profile pointer OpenXR binding.
|
|
/// </summary>
|
|
[Preserve, InputControl(offset = 0, alias = "aimPose", usage = "Pointer")]
|
|
public PoseControl pointer { get; private set; }
|
|
|
|
/// <summary>
|
|
/// A [ButtonControl](xref:UnityEngine.InputSystem.Controls.ButtonControl) required for backwards compatibility with the XRSDK layouts. This represents the overall tracking state of the device. This value is equivalent to mapping devicePose/isTracked.
|
|
/// </summary>
|
|
[Preserve, InputControl(offset = 53)]
|
|
new public ButtonControl isTracked { get; private set; }
|
|
|
|
/// <summary>
|
|
/// A [IntegerControl](xref:UnityEngine.InputSystem.Controls.IntegerControl) required for backwards compatibility with the XRSDK layouts. This represents the bit flag set indicating what data is valid. This value is equivalent to mapping devicePose/trackingState.
|
|
/// </summary>
|
|
[Preserve, InputControl(offset = 56)]
|
|
new public IntegerControl trackingState { get; private set; }
|
|
|
|
/// <summary>
|
|
/// A [Vector3Control](xref:UnityEngine.InputSystem.Controls.Vector3Control) required for backwards compatibility with the XRSDK layouts. This is the device position, or grip position. This value is equivalent to mapping devicePose/position.
|
|
/// </summary>
|
|
[Preserve, InputControl(offset = 60, alias = "gripPosition")]
|
|
new public Vector3Control devicePosition { get; private set; }
|
|
|
|
/// <summary>
|
|
/// A [QuaternionControl](xref:UnityEngine.InputSystem.Controls.QuaternionControl) required for backwards compatibility with the XRSDK layouts. This is the device orientation, or grip orientation. This value is equivalent to mapping devicePose/rotation.
|
|
/// </summary>
|
|
[Preserve, InputControl(offset = 72, alias = "gripOrientation")]
|
|
new public QuaternionControl deviceRotation { get; private set; }
|
|
|
|
/// <summary>
|
|
/// A [Vector3Control](xref:UnityEngine.InputSystem.Controls.Vector3Control) required for backwards compatibility with the XRSDK layouts. This is the pointer position. This value is equivalent to mapping pointerPose/position.
|
|
/// </summary>
|
|
[Preserve, InputControl(offset = 120)]
|
|
public Vector3Control pointerPosition { get; private set; }
|
|
|
|
/// <summary>
|
|
/// A [QuaternionControl](xref:UnityEngine.InputSystem.Controls.QuaternionControl) required for backwards compatibility with the XRSDK layouts. This is the pointer rotation. This value is equivalent to mapping pointerPose/rotation.
|
|
/// </summary>
|
|
[Preserve, InputControl(offset = 132, alias = "pointerOrientation")]
|
|
public QuaternionControl pointerRotation { get; private set; }
|
|
|
|
/// <summary>
|
|
/// A <see cref="HapticControl"/> that represents the <see cref="ValveIndexControllerProfile.haptic"/> binding.
|
|
/// </summary>
|
|
[Preserve, InputControl(usage = "Haptic")]
|
|
public HapticControl haptic { get; private set; }
|
|
|
|
/// <inheritdoc cref="OpenXRDevice"/>
|
|
protected override void FinishSetup()
|
|
{
|
|
base.FinishSetup();
|
|
system = GetChildControl<ButtonControl>("system");
|
|
systemTouched = GetChildControl<ButtonControl>("systemTouched");
|
|
primaryButton = GetChildControl<ButtonControl>("primaryButton");
|
|
primaryTouched = GetChildControl<ButtonControl>("primaryTouched");
|
|
secondaryButton = GetChildControl<ButtonControl>("secondaryButton");
|
|
secondaryTouched = GetChildControl<ButtonControl>("secondaryTouched");
|
|
grip = GetChildControl<AxisControl>("grip");
|
|
gripPressed = GetChildControl<ButtonControl>("gripPressed");
|
|
gripForce = GetChildControl<AxisControl>("gripForce");
|
|
trigger = GetChildControl<AxisControl>("trigger");
|
|
triggerPressed = GetChildControl<ButtonControl>("triggerPressed");
|
|
triggerTouched = GetChildControl<ButtonControl>("triggerTouched");
|
|
thumbstick = GetChildControl<StickControl>("thumbstick");
|
|
thumbstickClicked = GetChildControl<ButtonControl>("thumbstickClicked");
|
|
thumbstickTouched = GetChildControl<ButtonControl>("thumbstickTouched");
|
|
trackpad = GetChildControl<StickControl>("trackpad");
|
|
trackpadTouched = GetChildControl<ButtonControl>("trackpadTouched");
|
|
trackpadForce = GetChildControl<AxisControl>("trackpadForce");
|
|
devicePose = GetChildControl<PoseControl>("devicePose");
|
|
pointer = GetChildControl<PoseControl>("pointer");
|
|
|
|
isTracked = GetChildControl<ButtonControl>("isTracked");
|
|
trackingState = GetChildControl<IntegerControl>("trackingState");
|
|
devicePosition = GetChildControl<Vector3Control>("devicePosition");
|
|
deviceRotation = GetChildControl<QuaternionControl>("deviceRotation");
|
|
pointerPosition = GetChildControl<Vector3Control>("pointerPosition");
|
|
pointerRotation = GetChildControl<QuaternionControl>("pointerRotation");
|
|
|
|
haptic = GetChildControl<HapticControl>("haptic");
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// The interaction profile string used to reference the <a href="https://www.khronos.org/registry/OpenXR/specs/1.0/html/xrspec.html#_valve_index_controller_profile">Valve Index Controller</a>.
|
|
/// </summary>
|
|
public const string profile = "/interaction_profiles/valve/index_controller";
|
|
|
|
/// <summary>
|
|
/// Constant for a boolean interaction binding '.../input/system/click' OpenXR Input Binding.
|
|
/// </summary>
|
|
public const string system = "/input/system/click";
|
|
/// <summary>
|
|
/// Constant for a boolean interaction binding '.../input/system/touch' OpenXR Input Binding.
|
|
/// </summary>
|
|
public const string systemTouch = "/input/system/touch";
|
|
/// <summary>
|
|
/// Constant for a boolean interaction binding '.../input/a/click' OpenXR Input Binding.
|
|
/// </summary>
|
|
public const string buttonA = "/input/a/click";
|
|
/// <summary>
|
|
/// Constant for a boolean interaction binding '.../input/a/touch' OpenXR Input Binding.
|
|
/// </summary>
|
|
public const string buttonATouch = "/input/a/touch";
|
|
/// <summary>
|
|
/// Constant for a boolean interaction binding '.../input/b/click' OpenXR Input Binding.
|
|
/// </summary>
|
|
public const string buttonB = "/input/b/click";
|
|
/// <summary>
|
|
/// Constant for a boolean interaction binding '.../input/b/touch' OpenXR Input Binding.
|
|
/// </summary>
|
|
public const string buttonBTouch = "/input/b/touch";
|
|
/// <summary>
|
|
/// Constant for a float interaction binding '.../input/squeeze/value' OpenXR Input Binding.
|
|
/// </summary>
|
|
public const string squeeze = "/input/squeeze/value";
|
|
/// <summary>
|
|
/// Constant for a float interaction binding '.../input/squeeze/force' OpenXR Input Binding.
|
|
/// </summary>
|
|
public const string squeezeForce = "/input/squeeze/force";
|
|
/// <summary>
|
|
/// Constant for a boolean interaction binding '.../input/trigger/click' OpenXR Input Binding.
|
|
/// </summary>
|
|
public const string triggerClick = "/input/trigger/click";
|
|
/// <summary>
|
|
/// Constant for a float interaction binding '.../input/trigger/value' OpenXR Input Binding.
|
|
/// </summary>
|
|
public const string trigger = "/input/trigger/value";
|
|
/// <summary>
|
|
/// Constant for a boolean interaction binding '.../input/trigger/touch' OpenXR Input Binding.
|
|
/// </summary>
|
|
public const string triggerTouch = "/input/trigger/touch";
|
|
/// <summary>
|
|
/// Constant for a Vector2 interaction binding '.../input/thumbstick' OpenXR Input Binding.
|
|
/// </summary>
|
|
public const string thumbstick = "/input/thumbstick";
|
|
/// <summary>
|
|
/// Constant for a boolean interaction binding '.../input/thumbstick/click' OpenXR Input Binding.
|
|
/// </summary>
|
|
public const string thumbstickClick = "/input/thumbstick/click";
|
|
/// <summary>
|
|
/// Constant for a boolean interaction binding '.../input/thumbstick/touch' OpenXR Input Binding.
|
|
/// </summary>
|
|
public const string thumbstickTouch = "/input/thumbstick/touch";
|
|
/// <summary>
|
|
/// Constant for a Vector2 interaction binding '.../input/trackpad' OpenXR Input Binding.
|
|
/// </summary>
|
|
public const string trackpad = "/input/trackpad";
|
|
/// <summary>
|
|
/// Constant for a float interaction binding '.../input/trackpad/force' OpenXR Input Binding.
|
|
/// </summary>
|
|
public const string trackpadForce = "/input/trackpad/force";
|
|
/// <summary>
|
|
/// Constant for a boolean interaction binding '.../input/trackpad/touch' OpenXR Input Binding.
|
|
/// </summary>
|
|
public const string trackpadTouch = "/input/trackpad/touch";
|
|
/// <summary>
|
|
/// Constant for a pose interaction binding '.../input/grip/pose' OpenXR Input Binding.
|
|
/// </summary>
|
|
public const string grip = "/input/grip/pose";
|
|
/// <summary>
|
|
/// Constant for a pose interaction binding '.../input/aim/pose' OpenXR Input Binding.
|
|
/// </summary>
|
|
public const string aim = "/input/aim/pose";
|
|
/// <summary>
|
|
/// Constant for a haptic interaction binding '.../output/haptic' OpenXR Input Binding.
|
|
/// </summary>
|
|
public const string haptic = "/output/haptic";
|
|
|
|
private const string kDeviceLocalizedName = "Index Controller OpenXR";
|
|
|
|
/// <summary>
|
|
/// Registers the <see cref="ValveIndexController"/> layout with the Input System.
|
|
/// </summary>
|
|
protected override void RegisterDeviceLayout()
|
|
{
|
|
#if UNITY_EDITOR
|
|
if (!OpenXRLoaderEnabledForSelectedBuildTarget(EditorUserBuildSettings.selectedBuildTargetGroup))
|
|
return;
|
|
#endif
|
|
InputSystem.InputSystem.RegisterLayout(typeof(ValveIndexController),
|
|
matches: new InputDeviceMatcher()
|
|
.WithInterface(XRUtilities.InterfaceMatchAnyVersion)
|
|
.WithProduct(kDeviceLocalizedName));
|
|
}
|
|
|
|
/// <summary>
|
|
/// Removes the <see cref="ValveIndexController"/> layout from the Input System.
|
|
/// </summary>
|
|
protected override void UnregisterDeviceLayout()
|
|
{
|
|
#if UNITY_EDITOR
|
|
if (!OpenXRLoaderEnabledForSelectedBuildTarget(EditorUserBuildSettings.selectedBuildTargetGroup))
|
|
return;
|
|
#endif
|
|
InputSystem.InputSystem.RemoveLayout(nameof(ValveIndexController));
|
|
}
|
|
|
|
/// <summary>
|
|
/// Return device layout string that used for registering device for the Input System.
|
|
/// </summary>
|
|
/// <returns>Device layout string.</returns>
|
|
protected override string GetDeviceLayoutName()
|
|
{
|
|
return nameof(ValveIndexController);
|
|
}
|
|
|
|
/// <inheritdoc/>
|
|
protected override void RegisterActionMapsWithRuntime()
|
|
{
|
|
ActionMapConfig actionMap = new ActionMapConfig()
|
|
{
|
|
name = "valveindexcontroller",
|
|
localizedName = kDeviceLocalizedName,
|
|
desiredInteractionProfile = profile,
|
|
manufacturer = "Valve",
|
|
serialNumber = "",
|
|
deviceInfos = new List<DeviceConfig>()
|
|
{
|
|
new DeviceConfig()
|
|
{
|
|
characteristics = (InputDeviceCharacteristics)(InputDeviceCharacteristics.HeldInHand | InputDeviceCharacteristics.TrackedDevice | InputDeviceCharacteristics.Controller | InputDeviceCharacteristics.Left),
|
|
userPath = UserPaths.leftHand
|
|
},
|
|
new DeviceConfig()
|
|
{
|
|
characteristics = (InputDeviceCharacteristics)(InputDeviceCharacteristics.HeldInHand | InputDeviceCharacteristics.TrackedDevice | InputDeviceCharacteristics.Controller | InputDeviceCharacteristics.Right),
|
|
userPath = UserPaths.rightHand
|
|
}
|
|
},
|
|
actions = new List<ActionConfig>()
|
|
{
|
|
new ActionConfig()
|
|
{
|
|
name = "system",
|
|
localizedName = "System",
|
|
type = ActionType.Binary,
|
|
usages = new List<string>()
|
|
{
|
|
"MenuButton"
|
|
},
|
|
bindings = new List<ActionBinding>()
|
|
{
|
|
new ActionBinding()
|
|
{
|
|
interactionPath = system,
|
|
interactionProfileName = profile,
|
|
}
|
|
}
|
|
},
|
|
new ActionConfig()
|
|
{
|
|
name = "systemTouched",
|
|
localizedName = "System Touched",
|
|
type = ActionType.Binary,
|
|
usages = new List<string>()
|
|
{
|
|
"MenuTouch"
|
|
},
|
|
bindings = new List<ActionBinding>()
|
|
{
|
|
new ActionBinding()
|
|
{
|
|
interactionPath = systemTouch,
|
|
interactionProfileName = profile,
|
|
}
|
|
}
|
|
},
|
|
new ActionConfig()
|
|
{
|
|
name = "primaryButton",
|
|
localizedName = "Primary Button",
|
|
type = ActionType.Binary,
|
|
usages = new List<string>()
|
|
{
|
|
"PrimaryButton"
|
|
},
|
|
bindings = new List<ActionBinding>()
|
|
{
|
|
new ActionBinding()
|
|
{
|
|
interactionPath = buttonA,
|
|
interactionProfileName = profile,
|
|
}
|
|
}
|
|
},
|
|
new ActionConfig()
|
|
{
|
|
name = "primaryTouched",
|
|
localizedName = "Primary Touched",
|
|
type = ActionType.Binary,
|
|
usages = new List<string>()
|
|
{
|
|
"PrimaryTouch"
|
|
},
|
|
bindings = new List<ActionBinding>()
|
|
{
|
|
new ActionBinding()
|
|
{
|
|
interactionPath = buttonATouch,
|
|
interactionProfileName = profile,
|
|
}
|
|
}
|
|
},
|
|
new ActionConfig()
|
|
{
|
|
name = "secondaryButton",
|
|
localizedName = "Secondary Button",
|
|
type = ActionType.Binary,
|
|
usages = new List<string>()
|
|
{
|
|
"SecondaryButton"
|
|
},
|
|
bindings = new List<ActionBinding>()
|
|
{
|
|
new ActionBinding()
|
|
{
|
|
interactionPath = buttonB,
|
|
interactionProfileName = profile,
|
|
}
|
|
}
|
|
},
|
|
new ActionConfig()
|
|
{
|
|
name = "secondaryTouched",
|
|
localizedName = "Secondary Touched",
|
|
type = ActionType.Binary,
|
|
usages = new List<string>()
|
|
{
|
|
"SecondaryTouch"
|
|
},
|
|
bindings = new List<ActionBinding>()
|
|
{
|
|
new ActionBinding()
|
|
{
|
|
interactionPath = buttonBTouch,
|
|
interactionProfileName = profile,
|
|
}
|
|
}
|
|
},
|
|
new ActionConfig()
|
|
{
|
|
name = "grip",
|
|
localizedName = "Grip",
|
|
type = ActionType.Axis1D,
|
|
usages = new List<string>()
|
|
{
|
|
"Grip"
|
|
},
|
|
bindings = new List<ActionBinding>()
|
|
{
|
|
new ActionBinding()
|
|
{
|
|
interactionPath = squeeze,
|
|
interactionProfileName = profile,
|
|
}
|
|
}
|
|
},
|
|
new ActionConfig()
|
|
{
|
|
name = "gripPressed",
|
|
localizedName = "Grip Pressed",
|
|
type = ActionType.Binary,
|
|
usages = new List<string>()
|
|
{
|
|
"GripButton"
|
|
},
|
|
bindings = new List<ActionBinding>()
|
|
{
|
|
new ActionBinding()
|
|
{
|
|
interactionPath = squeeze,
|
|
interactionProfileName = profile,
|
|
}
|
|
}
|
|
},
|
|
new ActionConfig()
|
|
{
|
|
name = "gripForce",
|
|
localizedName = "Grip Force",
|
|
type = ActionType.Axis1D,
|
|
usages = new List<string>()
|
|
{
|
|
"GripForce"
|
|
},
|
|
bindings = new List<ActionBinding>()
|
|
{
|
|
new ActionBinding()
|
|
{
|
|
interactionPath = squeezeForce,
|
|
interactionProfileName = profile,
|
|
}
|
|
}
|
|
},
|
|
new ActionConfig()
|
|
{
|
|
name = "trigger",
|
|
localizedName = "Trigger",
|
|
type = ActionType.Axis1D,
|
|
usages = new List<string>()
|
|
{
|
|
"Trigger"
|
|
},
|
|
bindings = new List<ActionBinding>()
|
|
{
|
|
new ActionBinding()
|
|
{
|
|
interactionPath = trigger,
|
|
interactionProfileName = profile,
|
|
}
|
|
}
|
|
},
|
|
new ActionConfig()
|
|
{
|
|
name = "triggerPressed",
|
|
localizedName = "Triggger Pressed",
|
|
type = ActionType.Binary,
|
|
usages = new List<string>()
|
|
{
|
|
"TriggerButton"
|
|
},
|
|
bindings = new List<ActionBinding>()
|
|
{
|
|
new ActionBinding()
|
|
{
|
|
interactionPath = triggerClick,
|
|
interactionProfileName = profile,
|
|
}
|
|
}
|
|
},
|
|
new ActionConfig()
|
|
{
|
|
name = "triggerTouched",
|
|
localizedName = "Trigger Touched",
|
|
type = ActionType.Binary,
|
|
usages = new List<string>()
|
|
{
|
|
"TriggerTouch"
|
|
},
|
|
bindings = new List<ActionBinding>()
|
|
{
|
|
new ActionBinding()
|
|
{
|
|
interactionPath = triggerTouch,
|
|
interactionProfileName = profile,
|
|
}
|
|
}
|
|
},
|
|
|
|
new ActionConfig()
|
|
{
|
|
name = "thumbstick",
|
|
localizedName = "Thumbstick",
|
|
type = ActionType.Axis2D,
|
|
usages = new List<string>()
|
|
{
|
|
"Primary2DAxis"
|
|
},
|
|
bindings = new List<ActionBinding>()
|
|
{
|
|
new ActionBinding()
|
|
{
|
|
interactionPath = thumbstick,
|
|
interactionProfileName = profile,
|
|
}
|
|
}
|
|
},
|
|
new ActionConfig()
|
|
{
|
|
name = "thumbstickClicked",
|
|
localizedName = "Thumbstick Clicked",
|
|
type = ActionType.Binary,
|
|
usages = new List<string>()
|
|
{
|
|
"Primary2DAxisClick"
|
|
},
|
|
bindings = new List<ActionBinding>()
|
|
{
|
|
new ActionBinding()
|
|
{
|
|
interactionPath = thumbstickClick,
|
|
interactionProfileName = profile,
|
|
}
|
|
}
|
|
},
|
|
new ActionConfig()
|
|
{
|
|
name = "thumbstickTouched",
|
|
localizedName = "Thumbstick Touched",
|
|
type = ActionType.Binary,
|
|
usages = new List<string>()
|
|
{
|
|
"Primary2DAxisTouch"
|
|
},
|
|
bindings = new List<ActionBinding>()
|
|
{
|
|
new ActionBinding()
|
|
{
|
|
interactionPath = thumbstickTouch,
|
|
interactionProfileName = profile,
|
|
}
|
|
}
|
|
},
|
|
new ActionConfig()
|
|
{
|
|
name = "trackpad",
|
|
localizedName = "Trackpad",
|
|
type = ActionType.Axis2D,
|
|
usages = new List<string>()
|
|
{
|
|
"Secondary2DAxis"
|
|
},
|
|
bindings = new List<ActionBinding>()
|
|
{
|
|
new ActionBinding()
|
|
{
|
|
interactionPath = trackpad,
|
|
interactionProfileName = profile,
|
|
}
|
|
}
|
|
},
|
|
new ActionConfig()
|
|
{
|
|
name = "trackpadForce",
|
|
localizedName = "Trackpad Force",
|
|
type = ActionType.Axis1D,
|
|
usages = new List<string>()
|
|
{
|
|
"Secondary2DAxisForce"
|
|
},
|
|
bindings = new List<ActionBinding>()
|
|
{
|
|
new ActionBinding()
|
|
{
|
|
interactionPath = trackpadForce,
|
|
interactionProfileName = profile,
|
|
}
|
|
}
|
|
},
|
|
new ActionConfig()
|
|
{
|
|
name = "trackpadTouched",
|
|
localizedName = "Trackpad Touched",
|
|
type = ActionType.Binary,
|
|
usages = new List<string>()
|
|
{
|
|
"Secondary2DAxisTouch"
|
|
},
|
|
bindings = new List<ActionBinding>()
|
|
{
|
|
new ActionBinding()
|
|
{
|
|
interactionPath = trackpadTouch,
|
|
interactionProfileName = profile,
|
|
}
|
|
}
|
|
},
|
|
// Device Pose
|
|
new ActionConfig()
|
|
{
|
|
name = "devicePose",
|
|
localizedName = "Device Pose",
|
|
type = ActionType.Pose,
|
|
usages = new List<string>()
|
|
{
|
|
"Device"
|
|
},
|
|
bindings = new List<ActionBinding>()
|
|
{
|
|
new ActionBinding()
|
|
{
|
|
interactionPath = grip,
|
|
interactionProfileName = profile,
|
|
}
|
|
}
|
|
},
|
|
// Pointer Pose
|
|
new ActionConfig()
|
|
{
|
|
name = "pointer",
|
|
localizedName = "Pointer Pose",
|
|
type = ActionType.Pose,
|
|
usages = new List<string>()
|
|
{
|
|
"Pointer"
|
|
},
|
|
bindings = new List<ActionBinding>()
|
|
{
|
|
new ActionBinding()
|
|
{
|
|
interactionPath = aim,
|
|
interactionProfileName = profile,
|
|
}
|
|
}
|
|
},
|
|
// Haptics
|
|
new ActionConfig()
|
|
{
|
|
name = "haptic",
|
|
localizedName = "Haptic Output",
|
|
type = ActionType.Vibrate,
|
|
usages = new List<string>() { "Haptic" },
|
|
bindings = new List<ActionBinding>()
|
|
{
|
|
new ActionBinding()
|
|
{
|
|
interactionPath = haptic,
|
|
interactionProfileName = profile,
|
|
}
|
|
}
|
|
}
|
|
}
|
|
};
|
|
|
|
AddActionMap(actionMap);
|
|
}
|
|
}
|
|
}
|