/// <summary> /// Add an action map to the Unity Input System. /// /// This method must be called from within the RegisterActionMapsWithRuntime method. /// </summary> /// <param name="map">Action map to add</param> protected void AddActionMap(ActionMapConfig map) { if (!m_AllowAddActionMap) { Debug.LogError("ActionMap must be added from within the RegisterActionMapsWithRuntime method"); return; } OpenXRInput.AddActionMap(map); }
/// <summary> /// Add an action map to the Unity Input System. /// /// This method must be called from within the RegisterActionMapsWithRuntime method. /// </summary> /// <param name="map">Action map to add</param> protected void AddActionMap(ActionMapConfig map) { if (null == map) { throw new ArgumentNullException("map"); } if (null == m_CreatedActionMaps) { throw new InvalidOperationException("ActionMap must be added from within the RegisterActionMapsWithRuntime method"); } m_CreatedActionMaps.Add(map); }
/// <inheritdoc/> protected override void RegisterActionMapsWithRuntime() { ActionMapConfig actionMap = new ActionMapConfig() { name = "eyegaze", localizedName = kDeviceLocalizedName, desiredInteractionProfile = profile, manufacturer = "", serialNumber = "", deviceInfos = new List <DeviceConfig>() { new DeviceConfig() { characteristics = InputDeviceCharacteristics.TrackedDevice | InputDeviceCharacteristics.EyeTracking | InputDeviceCharacteristics.HeadMounted, userPath = userPath } }, actions = new List <ActionConfig>() { // Pointer Pose new ActionConfig() { name = "pose", localizedName = "Pose", type = ActionType.Pose, usages = new List <string>() { "Device", "gaze" }, bindings = new List <ActionBinding>() { new ActionBinding() { interactionPath = pose, interactionProfileName = profile, } } } } }; AddActionMap(actionMap); }
/// <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); }
/// <inheritdoc/> protected override void RegisterActionMapsWithRuntime() { ActionMapConfig actionMap = new ActionMapConfig() { name = "khrsimplecontroller", localizedName = kDeviceLocalizedName, desiredInteractionProfile = profile, manufacturer = "Khronos", 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>() { // Menu new ActionConfig() { name = "select", localizedName = "Select", type = ActionType.Binary, usages = new List <string>() { "PrimaryButton" }, bindings = new List <ActionBinding>() { new ActionBinding() { interactionPath = select, interactionProfileName = profile, } } }, // Trigger Pressed new ActionConfig() { name = "menu", localizedName = "Menu", type = ActionType.Binary, usages = new List <string>() { "MenuButton" }, bindings = new List <ActionBinding>() { new ActionBinding() { interactionPath = menu, 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); }
/// <inheritdoc/> protected override void RegisterActionMapsWithRuntime() { ActionMapConfig actionMap = new ActionMapConfig() { name = "microsoftmotioncontroller", localizedName = kDeviceLocalizedName, desiredInteractionProfile = profile, manufacturer = "Microsoft", 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>() { // Joystick new ActionConfig() { name = "joystick", localizedName = "Joystick", type = ActionType.Axis2D, usages = new List <string>() { "Primary2DAxis" }, bindings = new List <ActionBinding>() { new ActionBinding() { interactionPath = thumbstick, interactionProfileName = profile, } } }, // Touchpad new ActionConfig() { name = "touchpad", localizedName = "Touchpad", type = ActionType.Axis2D, usages = new List <string>() { "Secondary2DAxis" }, bindings = new List <ActionBinding>() { new ActionBinding() { interactionPath = trackpad, interactionProfileName = profile, } } }, // Grip new ActionConfig() { name = "grip", localizedName = "Grip", type = ActionType.Axis1D, usages = new List <string>() { "Grip" }, bindings = new List <ActionBinding>() { new ActionBinding() { interactionPath = squeeze, interactionProfileName = profile, } } }, // Grip Pressed 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, } } }, // Menu new ActionConfig() { name = "menu", localizedName = "Menu", type = ActionType.Binary, usages = new List <string>() { "MenuButton" }, bindings = new List <ActionBinding>() { new ActionBinding() { interactionPath = menu, interactionProfileName = profile, } } }, // Trigger new ActionConfig() { name = "trigger", localizedName = "Trigger", type = ActionType.Axis1D, usages = new List <string>() { "Trigger" }, bindings = new List <ActionBinding>() { new ActionBinding() { interactionPath = trigger, interactionProfileName = profile, } } }, // Trigger Pressed new ActionConfig() { name = "triggerPressed", localizedName = "Trigger Pressed", type = ActionType.Binary, usages = new List <string>() { "TriggerButton" }, bindings = new List <ActionBinding>() { new ActionBinding() { interactionPath = trigger, interactionProfileName = profile, } } }, //Joystick Clicked new ActionConfig() { name = "joystickClicked", localizedName = "JoystickClicked", type = ActionType.Binary, usages = new List <string>() { "Primary2DAxisClick" }, bindings = new List <ActionBinding>() { new ActionBinding() { interactionPath = thumbstickClick, interactionProfileName = profile, } } }, //Touchpad Clicked new ActionConfig() { name = "touchpadClicked", localizedName = "Touchpad Clicked", type = ActionType.Binary, usages = new List <string>() { "Secondary2DAxisClick" }, bindings = new List <ActionBinding>() { new ActionBinding() { interactionPath = trackpadClick, interactionProfileName = profile, } } }, //Touchpad Touched new ActionConfig() { name = "touchpadTouched", localizedName = "Touchpad 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 = "vibrate", localizedName = "Vibrate", type = ActionType.Vibrate, usages = new List <string>(), bindings = new List <ActionBinding>() { new ActionBinding() { interactionPath = haptic, interactionProfileName = profile, } } } } }; AddActionMap(actionMap); }
/// <inheritdoc/> protected override void RegisterActionMapsWithRuntime() { ActionMapConfig actionMap = new ActionMapConfig() { name = "microsofthandinteraction", localizedName = kDeviceLocalizedName, desiredInteractionProfile = profile, manufacturer = "Microsoft", serialNumber = "", deviceInfos = new List <DeviceConfig>() { new DeviceConfig() { characteristics = (InputDeviceCharacteristics)(InputDeviceCharacteristics.HandTracking | InputDeviceCharacteristics.HeldInHand | InputDeviceCharacteristics.TrackedDevice | InputDeviceCharacteristics.Controller | InputDeviceCharacteristics.Left), userPath = UserPaths.leftHand }, new DeviceConfig() { characteristics = (InputDeviceCharacteristics)(InputDeviceCharacteristics.HandTracking | InputDeviceCharacteristics.HeldInHand | InputDeviceCharacteristics.TrackedDevice | InputDeviceCharacteristics.Controller | InputDeviceCharacteristics.Right), userPath = UserPaths.rightHand } }, actions = new List <ActionConfig>() { // Select new ActionConfig() { name = "select", localizedName = "Select", type = ActionType.Axis1D, usages = new List <string>() { "PrimaryAxis" }, bindings = new List <ActionBinding>() { new ActionBinding() { interactionPath = select, interactionProfileName = profile, } } }, // Select Pressed new ActionConfig() { name = "selectPressed", localizedName = "Select Pressed", type = ActionType.Binary, usages = new List <string>() { "PrimaryButton" }, bindings = new List <ActionBinding>() { new ActionBinding() { interactionPath = select, interactionProfileName = profile, } } }, // Squeeze new ActionConfig() { name = "squeeze", localizedName = "Squeeze", type = ActionType.Axis1D, usages = new List <string>() { "Grip" }, bindings = new List <ActionBinding>() { new ActionBinding() { interactionPath = squeeze, interactionProfileName = profile, } } }, // Squeeze Pressed new ActionConfig() { name = "squeezePressed", localizedName = "Squeeze Pressed", type = ActionType.Binary, usages = new List <string>() { "GripButton" }, bindings = new List <ActionBinding>() { new ActionBinding() { interactionPath = squeeze, 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, } } } } }; AddActionMap(actionMap); }
/// <inheritdoc/> protected override void RegisterActionMapsWithRuntime() { ActionMapConfig actionMap = new ActionMapConfig() { name = "htcvivecontroller", localizedName = kDeviceLocalizedName, desiredInteractionProfile = profile, manufacturer = "HTC", 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 = "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 = "menu", localizedName = "Menu", type = ActionType.Binary, usages = new List <string>() { "MenuButton" }, bindings = new List <ActionBinding>() { new ActionBinding() { interactionPath = menu, interactionProfileName = profile, } } }, new ActionConfig() { name = "select", localizedName = "Select", type = ActionType.Binary, usages = new List <string>() { "SystemButton" }, bindings = new List <ActionBinding>() { new ActionBinding() { interactionPath = system, 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 = "Trigger Pressed", type = ActionType.Binary, usages = new List <string>() { "TriggerButton" }, bindings = new List <ActionBinding>() { new ActionBinding() { interactionPath = triggerClick, interactionProfileName = profile, } } }, new ActionConfig() { name = "trackpad", localizedName = "Trackpad", type = ActionType.Axis2D, usages = new List <string>() { "Primary2DAxis" }, bindings = new List <ActionBinding>() { new ActionBinding() { interactionPath = trackpad, interactionProfileName = profile, } } }, new ActionConfig() { name = "trackpadTouched", localizedName = "Trackpad Touched", type = ActionType.Binary, usages = new List <string>() { "Primary2DAxisTouch" }, bindings = new List <ActionBinding>() { new ActionBinding() { interactionPath = trackpadTouch, interactionProfileName = profile, } } }, new ActionConfig() { name = "trackpadClicked", localizedName = "Trackpad Clicked", type = ActionType.Binary, usages = new List <string>() { "Primary2DAxisClick" }, bindings = new List <ActionBinding>() { new ActionBinding() { interactionPath = trackpadClick, interactionProfileName = profile, } } }, 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, } } }, } }; AddActionMap(actionMap); }