diff --git a/XRTK-Core/Packages/com.xrtk.core/AssemblyInfo.cs b/XRTK-Core/Packages/com.xrtk.core/AssemblyInfo.cs
index 2311a10fc..29ef21efc 100644
--- a/XRTK-Core/Packages/com.xrtk.core/AssemblyInfo.cs
+++ b/XRTK-Core/Packages/com.xrtk.core/AssemblyInfo.cs
@@ -10,3 +10,4 @@
[assembly: InternalsVisibleTo("XRTK.Utilities.Gltf.Importers")]
[assembly: InternalsVisibleTo("XRTK.WindowsMixedReality")]
[assembly: InternalsVisibleTo("XRTK.WindowsMixedReality.Player")]
+[assembly: InternalsVisibleTo("XRTK.Oculus")]
\ No newline at end of file
diff --git a/XRTK-Core/Packages/com.xrtk.core/Definitions/Devices/MixedRealityInteractionMapping.cs b/XRTK-Core/Packages/com.xrtk.core/Definitions/Devices/MixedRealityInteractionMapping.cs
index 2757df06c..c664cd6b0 100644
--- a/XRTK-Core/Packages/com.xrtk.core/Definitions/Devices/MixedRealityInteractionMapping.cs
+++ b/XRTK-Core/Packages/com.xrtk.core/Definitions/Devices/MixedRealityInteractionMapping.cs
@@ -34,6 +34,7 @@ public MixedRealityInteractionMapping(uint id, string description, AxisType axis
this.inputType = inputType;
inputAction = MixedRealityInputAction.None;
keyCode = KeyCode.None;
+ this.inputName = string.Empty;
this.axisCodeX = axisCodeX;
this.axisCodeY = axisCodeY;
this.invertXAxis = invertXAxis;
@@ -76,6 +77,34 @@ public MixedRealityInteractionMapping(uint id, string description, AxisType axis
changed = false;
}
+ ///
+ /// The constructor for a new Interaction Mapping definition
+ ///
+ /// Identity for mapping
+ /// The description of the interaction mapping.
+ /// The axis that the mapping operates on, also denotes the data type for the mapping
+ /// The physical input device / control
+ /// Optional inputName value to get input for a coded input identity from a provider
+ public MixedRealityInteractionMapping(uint id, string description, AxisType axisType, DeviceInputType inputType, string inputName)
+ {
+ this.id = id;
+ this.description = description;
+ this.axisType = axisType;
+ this.inputType = inputType;
+ inputAction = MixedRealityInputAction.None;
+ this.inputName = inputName;
+ axisCodeX = string.Empty;
+ axisCodeY = string.Empty;
+ rawData = null;
+ boolData = false;
+ floatData = 0f;
+ vector2Data = Vector2.zero;
+ positionData = Vector3.zero;
+ rotationData = Quaternion.identity;
+ poseData = MixedRealityPose.ZeroIdentity;
+ changed = false;
+ }
+
///
/// The constructor for a new Interaction Mapping definition
///
@@ -111,6 +140,41 @@ public MixedRealityInteractionMapping(uint id, string description, AxisType axis
changed = false;
}
+ ///
+ /// The constructor for a new Interaction Mapping definition
+ ///
+ /// Identity for mapping
+ /// The description of the interaction mapping.
+ /// The axis that the mapping operates on, also denotes the data type for the mapping
+ /// The physical input device / control
+ /// The logical MixedRealityInputAction that this input performs
+ /// Optional inputName value to get input for a coded input identity from a provider
+ /// Optional horizontal or single axis value to get axis data from Unity's old input system.
+ /// Optional vertical axis value to get axis data from Unity's old input system.
+ /// Optional horizontal axis invert option.
+ /// Optional vertical axis invert option.
+ public MixedRealityInteractionMapping(uint id, string description, AxisType axisType, DeviceInputType inputType, MixedRealityInputAction inputAction, string inputName, string axisCodeX = "", string axisCodeY = "", bool invertXAxis = false, bool invertYAxis = false)
+ {
+ this.id = id;
+ this.description = description;
+ this.axisType = axisType;
+ this.inputType = inputType;
+ this.inputAction = inputAction;
+ this.inputName = inputName;
+ this.axisCodeX = axisCodeX;
+ this.axisCodeY = axisCodeY;
+ this.invertXAxis = invertXAxis;
+ this.invertYAxis = invertYAxis;
+ rawData = null;
+ boolData = false;
+ floatData = 0f;
+ vector2Data = Vector2.zero;
+ positionData = Vector3.zero;
+ rotationData = Quaternion.identity;
+ poseData = MixedRealityPose.ZeroIdentity;
+ changed = false;
+ }
+
public MixedRealityInteractionMapping(MixedRealityInteractionMapping mixedRealityInteractionMapping)
{
id = mixedRealityInteractionMapping.id;
@@ -119,6 +183,7 @@ public MixedRealityInteractionMapping(MixedRealityInteractionMapping mixedRealit
inputType = mixedRealityInteractionMapping.inputType;
inputAction = mixedRealityInteractionMapping.inputAction;
keyCode = mixedRealityInteractionMapping.keyCode;
+ inputName = mixedRealityInteractionMapping.inputName;
axisCodeX = mixedRealityInteractionMapping.axisCodeX;
axisCodeY = mixedRealityInteractionMapping.axisCodeY;
invertXAxis = mixedRealityInteractionMapping.invertXAxis;
@@ -193,6 +258,15 @@ public MixedRealityInputAction MixedRealityInputAction
///
public KeyCode KeyCode => keyCode;
+ [SerializeField]
+ [Tooltip("Optional KeyCode value to get input from Unity's old input system.")]
+ private string inputName;
+
+ ///
+ /// Optional inputName value to get input for a coded input identity from a provider.
+ ///
+ public string InputName => inputName;
+
[SerializeField]
[Tooltip("Optional horizontal or single axis value to get axis data from Unity's old input system.")]
private string axisCodeX;
diff --git a/XRTK-Core/Packages/com.xrtk.core/Extensions/InteractionMappingsExtensions.cs b/XRTK-Core/Packages/com.xrtk.core/Extensions/InteractionMappingsExtensions.cs
new file mode 100644
index 000000000..391dceb4a
--- /dev/null
+++ b/XRTK-Core/Packages/com.xrtk.core/Extensions/InteractionMappingsExtensions.cs
@@ -0,0 +1,68 @@
+// Copyright (c) XRTK. All rights reserved.
+// Licensed under the MIT License. See LICENSE in the project root for license information.
+
+using XRTK.Definitions.Devices;
+using XRTK.Definitions.Utilities;
+using XRTK.Interfaces.InputSystem;
+using XRTK.Services;
+
+namespace XRTK.Extensions
+{
+ ///
+ /// Extensions for the InteractionMapping class to refactor the generic methods used for raising events in InteractionMappings.
+ ///
+ public static class InteractionMappingsExtensions
+ {
+ public static void UpdateInteractionMappingBool(this MixedRealityInteractionMapping interactionMapping, IMixedRealityInputSource inputSource, Handedness controllerHandedness)
+ {
+ // If our value changed raise it.
+ if (interactionMapping.Changed)
+ {
+ // Raise input system Event if it enabled
+ if (interactionMapping.BoolData)
+ {
+ MixedRealityToolkit.InputSystem?.RaiseOnInputDown(inputSource, controllerHandedness, interactionMapping.MixedRealityInputAction);
+ }
+ else
+ {
+ MixedRealityToolkit.InputSystem?.RaiseOnInputUp(inputSource, controllerHandedness, interactionMapping.MixedRealityInputAction);
+ }
+ }
+
+ if (interactionMapping.Updated)
+ {
+ MixedRealityToolkit.InputSystem?.RaiseOnInputPressed(inputSource, controllerHandedness, interactionMapping.MixedRealityInputAction);
+ }
+ }
+
+ public static void UpdateInteractionMappingFloat(this MixedRealityInteractionMapping interactionMapping, IMixedRealityInputSource inputSource, Handedness controllerHandedness)
+ {
+ // If our value changed raise it.
+ if (interactionMapping.Updated)
+ {
+ // Raise input system Event if it enabled
+ MixedRealityToolkit.InputSystem?.RaiseOnInputPressed(inputSource, controllerHandedness, interactionMapping.MixedRealityInputAction, interactionMapping.FloatData);
+ }
+ }
+
+ public static void UpdateInteractionMappingVector2(this MixedRealityInteractionMapping interactionMapping, IMixedRealityInputSource inputSource, Handedness controllerHandedness)
+ {
+ // If our value changed raise it.
+ if (interactionMapping.Updated)
+ {
+ // Raise input system Event if it enabled
+ MixedRealityToolkit.InputSystem?.RaisePositionInputChanged(inputSource, controllerHandedness, interactionMapping.MixedRealityInputAction, interactionMapping.Vector2Data);
+ }
+ }
+
+ public static void UpdateInteractionMappingPose(this MixedRealityInteractionMapping interactionMapping, IMixedRealityInputSource inputSource, Handedness controllerHandedness)
+ {
+ // If our value changed raise it.
+ if (interactionMapping.Updated)
+ {
+ // Raise input system Event if it enabled
+ MixedRealityToolkit.InputSystem?.RaisePoseInputChanged(inputSource, controllerHandedness, interactionMapping.MixedRealityInputAction, interactionMapping.PoseData);
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/XRTK-Core/Packages/com.xrtk.core/Extensions/InteractionMappingsExtensions.cs.meta b/XRTK-Core/Packages/com.xrtk.core/Extensions/InteractionMappingsExtensions.cs.meta
new file mode 100644
index 000000000..aad294d33
--- /dev/null
+++ b/XRTK-Core/Packages/com.xrtk.core/Extensions/InteractionMappingsExtensions.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 386c7dbb4764ea74aa7446d4fd0c499f
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {fileID: 2800000, guid: 8ac5213854cf4dbabd140decf8df1946, type: 3}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/XRTK-Core/Packages/com.xrtk.core/package.json b/XRTK-Core/Packages/com.xrtk.core/package.json
index 5e8f9bd15..8a33b0f8a 100644
--- a/XRTK-Core/Packages/com.xrtk.core/package.json
+++ b/XRTK-Core/Packages/com.xrtk.core/package.json
@@ -2,7 +2,7 @@
"name": "com.xrtk.core",
"displayName": "XRTK.Core",
"description": "The core framework of the Mixed Reality Toolkit",
- "version": "0.1.12",
+ "version": "0.1.13",
"unity": "2019.1",
"license": "MIT",
"repository": {