diff --git a/UnityProjects/MRTKDevTemplate/Packages/packages-lock.json b/UnityProjects/MRTKDevTemplate/Packages/packages-lock.json
index f282671d1..e74315252 100644
--- a/UnityProjects/MRTKDevTemplate/Packages/packages-lock.json
+++ b/UnityProjects/MRTKDevTemplate/Packages/packages-lock.json
@@ -400,6 +400,7 @@
"source": "local",
"dependencies": {
"org.mixedrealitytoolkit.core": "4.0.0",
+ "org.mixedrealitytoolkit.input": "4.0.0",
"org.mixedrealitytoolkit.uxcore": "4.0.0",
"com.unity.inputsystem": "1.6.1",
"com.unity.xr.interaction.toolkit": "3.0.4"
diff --git a/org.mixedrealitytoolkit.core/Interactables/MRTKBaseInteractable.cs b/org.mixedrealitytoolkit.core/Interactables/MRTKBaseInteractable.cs
index 55849d28a..cce72f168 100644
--- a/org.mixedrealitytoolkit.core/Interactables/MRTKBaseInteractable.cs
+++ b/org.mixedrealitytoolkit.core/Interactables/MRTKBaseInteractable.cs
@@ -95,7 +95,7 @@ public class MRTKBaseInteractable : XRBaseInteractable
///
/// Is this object selected by a gaze-pinch interactor?
///
- public TimedFlag IsGazePinchSelected { get => isGazePinchSelected; }
+ public TimedFlag IsGazePinchSelected => isGazePinchSelected;
[SerializeField]
[Tooltip("Is this object selected by a non-gaze ray interactor?")]
@@ -104,7 +104,7 @@ public class MRTKBaseInteractable : XRBaseInteractable
///
/// Is this object selected by a non-gaze ray interactor?
///
- public TimedFlag IsRaySelected { get => isRaySelected; }
+ public TimedFlag IsRaySelected => isRaySelected;
[SerializeField]
[Tooltip("Is this object selected by a poke interactor?")]
@@ -113,7 +113,7 @@ public class MRTKBaseInteractable : XRBaseInteractable
///
/// Is this object selected by a poke interactor?
///
- public TimedFlag IsPokeSelected { get => isPokeSelected; }
+ public TimedFlag IsPokeSelected => isPokeSelected;
[SerializeField]
[Tooltip("Is this object selected by a grab interactor?")]
@@ -122,7 +122,7 @@ public class MRTKBaseInteractable : XRBaseInteractable
///
/// Is this object selected by a grab interactor?
///
- public TimedFlag IsGrabSelected { get => isGrabSelected; }
+ public TimedFlag IsGrabSelected => isGrabSelected;
[SerializeField]
[Tooltip("Is this object hovered by any gaze interactor?")]
@@ -131,7 +131,7 @@ public class MRTKBaseInteractable : XRBaseInteractable
///
/// Is this object hovered by any gaze interactor?
///
- public TimedFlag IsGazeHovered { get => isGazeHovered; }
+ public TimedFlag IsGazeHovered => isGazeHovered;
[SerializeField]
[Tooltip("Is this object hovered by a gaze-pinch interactor?")]
@@ -140,7 +140,7 @@ public class MRTKBaseInteractable : XRBaseInteractable
///
/// Is this object hovered by a gaze-pinch interactor?
///
- public TimedFlag IsGazePinchHovered { get => isGazePinchHovered; }
+ public TimedFlag IsGazePinchHovered => isGazePinchHovered;
[SerializeField]
[Tooltip("Is this object hovered by a non-gaze ray interactor?")]
@@ -149,7 +149,7 @@ public class MRTKBaseInteractable : XRBaseInteractable
///
/// Is this object hovered by a non-gaze ray interactor?
///
- public TimedFlag IsRayHovered { get => isRayHovered; }
+ public TimedFlag IsRayHovered => isRayHovered;
[SerializeField]
[Tooltip("Is this object hovered by a grab interactor?")]
@@ -158,7 +158,7 @@ public class MRTKBaseInteractable : XRBaseInteractable
///
/// Is this object hovered by a grab interactor?
///
- public TimedFlag IsGrabHovered { get => isGrabHovered; }
+ public TimedFlag IsGrabHovered => isGrabHovered;
[SerializeField]
[Tooltip("Is this object hovered by a near touch/poke interactor?")]
@@ -168,12 +168,12 @@ public class MRTKBaseInteractable : XRBaseInteractable
///
/// Is this object hovered by a near touch/poke interactor?
///
- public TimedFlag IsPokeHovered { get => isPokeHovered; }
+ public TimedFlag IsPokeHovered => isPokeHovered;
///
/// Is this object hovered by any interactor other than passive targeting interactors?
///
- public TimedFlag IsActiveHovered { get => isActiveHovered; }
+ public TimedFlag IsActiveHovered => isActiveHovered;
[SerializeField]
[Tooltip("Is this object hovered by any interactor other than only passive targeting interactors?")]
diff --git a/org.mixedrealitytoolkit.core/MRTK.Core.asmdef b/org.mixedrealitytoolkit.core/MRTK.Core.asmdef
index 3e56815ef..9d75a9ee5 100644
--- a/org.mixedrealitytoolkit.core/MRTK.Core.asmdef
+++ b/org.mixedrealitytoolkit.core/MRTK.Core.asmdef
@@ -4,8 +4,7 @@
"references": [
"Unity.XR.CoreUtils",
"Unity.XR.Interaction.Toolkit",
- "Unity.XR.Management",
- "Unity.InputSystem"
+ "Unity.XR.Management"
],
"includePlatforms": [],
"excludePlatforms": [],
diff --git a/org.mixedrealitytoolkit.core/Subsystems/MRTKLifecycleManager.cs b/org.mixedrealitytoolkit.core/Subsystems/MRTKLifecycleManager.cs
index ed28c877d..ea4033651 100644
--- a/org.mixedrealitytoolkit.core/Subsystems/MRTKLifecycleManager.cs
+++ b/org.mixedrealitytoolkit.core/Subsystems/MRTKLifecycleManager.cs
@@ -5,7 +5,6 @@
using System.Collections.Generic;
using Unity.Profiling;
using UnityEngine;
-using UnityEngine.InputSystem;
namespace MixedReality.Toolkit.Subsystems
{
@@ -19,9 +18,6 @@ public class MRTKLifecycleManager :
MonoBehaviour,
IDisposable
{
- [SerializeField, Tooltip("A set of input actions to enable/disable according to the app's focus state.")]
- private InputActionReference[] inputActionReferences;
-
private List managedSubsystems = new List();
///
@@ -191,17 +187,7 @@ protected void OnApplicationFocus(bool focus)
// and applications should react to an inactive input action by skipping rendering of that action's input avatar
// (depictions of hands or other tracked objects controlled by the user)."
- foreach (InputActionReference reference in inputActionReferences)
- {
- if (focus)
- {
- reference.action.Enable();
- }
- else
- {
- reference.action.Disable();
- }
- }
+
}
#endregion MonoBehaviour
diff --git a/org.mixedrealitytoolkit.core/Utilities/TrackedPoseDriverLookup.cs b/org.mixedrealitytoolkit.input/Utilities/TrackedPoseDriverLookup.cs
similarity index 93%
rename from org.mixedrealitytoolkit.core/Utilities/TrackedPoseDriverLookup.cs
rename to org.mixedrealitytoolkit.input/Utilities/TrackedPoseDriverLookup.cs
index d5c9cd0b7..90441276e 100644
--- a/org.mixedrealitytoolkit.core/Utilities/TrackedPoseDriverLookup.cs
+++ b/org.mixedrealitytoolkit.input/Utilities/TrackedPoseDriverLookup.cs
@@ -62,7 +62,7 @@ private void OnValidate()
{
if (FindObjectsByType(FindObjectsSortMode.None).Length > 1)
{
- Debug.LogWarning("Found more than one instance of the ControllerLookup class in the hierarchy. There should only be one");
+ Debug.LogWarning($"Found more than one instance of the {nameof(TrackedPoseDriverLookup)} class in the hierarchy. There should only be one.");
}
}
}
diff --git a/org.mixedrealitytoolkit.core/Utilities/TrackedPoseDriverLookup.cs.meta b/org.mixedrealitytoolkit.input/Utilities/TrackedPoseDriverLookup.cs.meta
similarity index 100%
rename from org.mixedrealitytoolkit.core/Utilities/TrackedPoseDriverLookup.cs.meta
rename to org.mixedrealitytoolkit.input/Utilities/TrackedPoseDriverLookup.cs.meta
diff --git a/org.mixedrealitytoolkit.spatialmanipulation/MRTK.SpatialManipulation.asmdef b/org.mixedrealitytoolkit.spatialmanipulation/MRTK.SpatialManipulation.asmdef
index e0c489081..9a5670b6f 100644
--- a/org.mixedrealitytoolkit.spatialmanipulation/MRTK.SpatialManipulation.asmdef
+++ b/org.mixedrealitytoolkit.spatialmanipulation/MRTK.SpatialManipulation.asmdef
@@ -1,19 +1,20 @@
{
- "name": "MixedReality.Toolkit.SpatialManipulation",
- "rootNamespace": "MixedReality.Toolkit.SpatialManipulation",
- "references": [
- "MixedReality.Toolkit.Core",
- "Unity.InputSystem",
- "Unity.XR.CoreUtils",
- "Unity.XR.Interaction.Toolkit"
- ],
- "includePlatforms": [],
- "excludePlatforms": [],
- "allowUnsafeCode": false,
- "overrideReferences": false,
- "precompiledReferences": [],
- "autoReferenced": true,
- "defineConstraints": [],
- "versionDefines": [],
- "noEngineReferences": false
-}
+ "name": "MixedReality.Toolkit.SpatialManipulation",
+ "rootNamespace": "MixedReality.Toolkit.SpatialManipulation",
+ "references": [
+ "MixedReality.Toolkit.Core",
+ "MixedReality.Toolkit.Input",
+ "Unity.InputSystem",
+ "Unity.XR.CoreUtils",
+ "Unity.XR.Interaction.Toolkit"
+ ],
+ "includePlatforms": [],
+ "excludePlatforms": [],
+ "allowUnsafeCode": false,
+ "overrideReferences": false,
+ "precompiledReferences": [],
+ "autoReferenced": true,
+ "defineConstraints": [],
+ "versionDefines": [],
+ "noEngineReferences": false
+}
\ No newline at end of file
diff --git a/org.mixedrealitytoolkit.spatialmanipulation/Solvers/HandConstraintPalmUp.cs b/org.mixedrealitytoolkit.spatialmanipulation/Solvers/HandConstraintPalmUp.cs
index c0f2d07cf..5a2895df9 100644
--- a/org.mixedrealitytoolkit.spatialmanipulation/Solvers/HandConstraintPalmUp.cs
+++ b/org.mixedrealitytoolkit.spatialmanipulation/Solvers/HandConstraintPalmUp.cs
@@ -134,7 +134,7 @@ public float HeadGazeProximityThreshold
new ProfilerMarker("[MRTK] HandConstraintPalmUp.IsValidController");
///
- /// Determines if a hand meets the requirements for use with constraining the
+ /// Determines if a hand meets the requirements for use with constraining the
/// tracked object and determines if the palm is currently facing the user.
///
/// XRNode representing the hand to validate.
@@ -258,7 +258,7 @@ private bool IsPalmMeetingThresholdRequirements(
new ProfilerMarker("[MRTK] HandConstraintPalmUp.IsUserGazeMeetingThresholdRequirements");
///
- /// Checks to see if the user is currently gazing at the activation point; it first attempts to do so
+ /// Checks to see if the user is currently gazing at the activation point; it first attempts to do so
/// using eye gaze, and then falls back to head-based gaze if eye gaze isn't available for use.
///
///
@@ -266,7 +266,7 @@ private bool IsPalmMeetingThresholdRequirements(
///
///
/// if the user's gaze is within the proximity threshold of the activation point (both relative to the
- /// hand plane), or .
+ /// hand plane), or .
///
private bool IsUserGazeMeetingThresholdRequirements(XRNode hand)
{
@@ -275,7 +275,7 @@ private bool IsUserGazeMeetingThresholdRequirements(XRNode hand)
Ray? gazeRay = null;
bool usedEyeGaze = false;
- #pragma warning disable CS0618 // Type or member is obsolete
+#pragma warning disable CS0618 // Type or member is obsolete
if (ControllerLookup != null)
{
if (ControllerLookup.GazeController != null &&
@@ -283,8 +283,8 @@ private bool IsUserGazeMeetingThresholdRequirements(XRNode hand)
(InputTrackingState.Position | InputTrackingState.Rotation)) > 0)
{
gazeRay = new Ray(
- ControllerLookup.GazeController.transform.position,
- ControllerLookup.GazeController.transform.forward);
+ ControllerLookup.GazeController.transform.position,
+ ControllerLookup.GazeController.transform.forward);
usedEyeGaze = true;
}
else
@@ -294,7 +294,7 @@ private bool IsUserGazeMeetingThresholdRequirements(XRNode hand)
Camera.main.transform.forward);
}
}
- #pragma warning restore CS0618
+#pragma warning restore CS0618
else if (TrackedPoseDriverLookup != null)
{
InputTrackingState gazeTrackingStateInput = GetGazeInputTrackingState(TrackedPoseDriverLookup.GazeTrackedPoseDriver);
@@ -315,26 +315,22 @@ private bool IsUserGazeMeetingThresholdRequirements(XRNode hand)
}
else
{
- Debug.LogWarning("Neither ControllerLookup nor TrackedPoseDriverLookup are set, unable to determine whether user gaze meets threashold requirements or not.");
+ Debug.LogWarning("Neither ControllerLookup nor TrackedPoseDriverLookup are set, unable to determine whether user gaze meets threshold requirements or not.");
return false;
}
- if (gazeRay.HasValue)
+ // Define the activation point as a vector between the wrist and pinky knuckle; then cast it against the plane to get a smooth location
+ // If we can generate the hand plane or are able to set an activation point on it, and then are able to raycast against it
+ if (gazeRay.HasValue &&
+ TryGenerateHandPlaneAndActivationPoint(hand, out Plane handPlane, out Vector3 activationPoint) &&
+ handPlane.Raycast(gazeRay.Value, out float distanceToHandPlane))
{
- // Define the activation point as a vector between the wrist and pinky knuckle; then cast it against the plane to get a smooth location
- // If we can generate the hand plane or are able to set an activation point on it, and then are able to raycast against it
- if (TryGenerateHandPlaneAndActivationPoint(hand, out Plane handPlane, out Vector3 activationPoint) &&
- handPlane.Raycast(gazeRay.Value, out float distanceToHandPlane))
- {
- // Now that we know the dist to the plane, create a vector at that point
- Vector3 gazePosOnPlane = gazeRay.Value.origin + gazeRay.Value.direction.normalized * distanceToHandPlane;
- Vector3 planePos = handPlane.ClosestPointOnPlane(gazePosOnPlane);
- float gazePosDistToActivationPosition = (activationPoint - planePos).sqrMagnitude;
- float gazeActivationThreshold = usedEyeGaze ? eyeGazeProximityThreshold : headGazeProximityThreshold;
- gazeActivationAlreadyTriggered = (gazePosDistToActivationPosition < gazeActivationThreshold);
-
- return gazeActivationAlreadyTriggered;
- }
+ // Now that we know the distance to the plane, create a vector at that point
+ Vector3 gazePosOnPlane = gazeRay.Value.origin + gazeRay.Value.direction.normalized * distanceToHandPlane;
+ Vector3 planePos = handPlane.ClosestPointOnPlane(gazePosOnPlane);
+ float gazePosDistToActivationPosition = (activationPoint - planePos).sqrMagnitude;
+ float gazeActivationThreshold = usedEyeGaze ? eyeGazeProximityThreshold : headGazeProximityThreshold;
+ return gazeActivationAlreadyTriggered = gazePosDistToActivationPosition < gazeActivationThreshold;
}
return false;
@@ -342,8 +338,8 @@ private bool IsUserGazeMeetingThresholdRequirements(XRNode hand)
}
///
- /// Coroutine function called by the ObjectManipulator of the attached object whenever the object is done
- /// being manipulated by the user. This triggers a coroutine that checks to see whether the object should
+ /// Coroutine function called by the ObjectManipulator of the attached object whenever the object is done
+ /// being manipulated by the user. This triggers a coroutine that checks to see whether the object should
/// reattach to the hand.
///
public void StartWorldLockReattachCheckCoroutine()
@@ -521,7 +517,7 @@ private bool TryGenerateActivationPoint(
}
///
- /// Coroutine function that's invoked when the attached object becomes world-locked. It uses the
+ /// Coroutine function that's invoked when the attached object becomes world-locked. It uses the
/// logical checks invoked during IsValidController to determine whether the menu should reattach
/// to the hand or not.
///
@@ -531,19 +527,14 @@ private IEnumerator WorldLockedReattachCheck()
{
XRNode? hand = SolverHandler.CurrentTrackedHandedness.ToXRNode();
- if (hand.HasValue)
+ if (hand.HasValue &&
+ XRSubsystemHelpers.HandsAggregator != null &&
+ XRSubsystemHelpers.HandsAggregator.TryGetJoint(TrackedHandJoint.Palm, hand.Value, out HandJointPose palmPose) &&
+ IsPalmMeetingThresholdRequirements(hand.Value, palmPose, Vector3.Angle(palmPose.Up, Camera.main.transform.forward)) &&
+ IsUserGazeMeetingThresholdRequirements(hand.Value))
{
- if (XRSubsystemHelpers.HandsAggregator != null &&
- XRSubsystemHelpers.HandsAggregator.TryGetJoint(TrackedHandJoint.Palm, hand.Value, out HandJointPose palmPose))
- {
- float palmCameraAngle = Vector3.Angle(palmPose.Up, Camera.main.transform.forward);
- if (IsPalmMeetingThresholdRequirements(hand.Value, palmPose, palmCameraAngle) &&
- IsUserGazeMeetingThresholdRequirements(hand.Value))
- {
- gazeActivationAlreadyTriggered = false;
- SolverHandler.UpdateSolvers = true;
- }
- }
+ gazeActivationAlreadyTriggered = false;
+ SolverHandler.UpdateSolvers = true;
}
yield return null;
@@ -556,8 +547,8 @@ private IEnumerator WorldLockedReattachCheck()
/// A Unity event function that is called when the script component has been enabled.
///
///
- /// When enabled, ensure that there are no outlying status changes that would prevent HandConstraintPalmUp from
- /// properly working (like gazeActivationAlreadyTriggered being set to true previously)
+ /// When enabled, ensure that there are no outlying status changes that would prevent HandConstraintPalmUp from
+ /// properly working (like gazeActivationAlreadyTriggered being set to true previously).
///
protected override void OnEnable()
{
diff --git a/org.mixedrealitytoolkit.spatialmanipulation/Solvers/Solver.cs b/org.mixedrealitytoolkit.spatialmanipulation/Solvers/Solver.cs
index 930ef9a1d..f247aed6e 100644
--- a/org.mixedrealitytoolkit.spatialmanipulation/Solvers/Solver.cs
+++ b/org.mixedrealitytoolkit.spatialmanipulation/Solvers/Solver.cs
@@ -21,7 +21,7 @@ public abstract class Solver : MonoBehaviour
private static ControllerLookup controllerLookup;
///
- /// Get the ControllerLookup that will be used all application objects.
+ /// Get the that will be used all application objects.
///
[Obsolete("This property has been deprecated in version 4.0.0. Please use MixedReality.Toolkit.Input.TrackedPoseDriverLookup instead.")]
protected static ControllerLookup ControllerLookup => controllerLookup;
@@ -29,7 +29,7 @@ public abstract class Solver : MonoBehaviour
private static TrackedPoseDriverLookup trackedPoseDriverLookup;
///
- /// Get the TrackedPoseDriverLookup that will be used by all application objects.
+ /// Get the that will be used by all application objects.
///
protected static TrackedPoseDriverLookup TrackedPoseDriverLookup => trackedPoseDriverLookup;
@@ -272,7 +272,7 @@ protected virtual void Start()
{
// Find the controller lookup class in the hierarchy. Solvers that require access to the
// left, right or gaze controllers will use the references stored in this class.
- #pragma warning disable CS0618 // Type or member is obsolete
+#pragma warning disable CS0618 // Type or member is obsolete
if (controllerLookup == null)
{
controllerLookup = ComponentCache.FindFirstActiveInstance();
@@ -284,7 +284,7 @@ protected virtual void Start()
{
trackedPoseDriverLookup = ComponentCache.FindFirstActiveInstance();
}
- #pragma warning restore CS0618
+#pragma warning restore CS0618
}
#endregion MonoBehaviour Implementation
@@ -370,8 +370,7 @@ protected void UpdateTransformToGoal()
{
if (smoothing)
{
- Vector3 pos = transform.position;
- Quaternion rot = transform.rotation;
+ transform.GetPositionAndRotation(out Vector3 pos, out Quaternion rot);
Vector3 scale = transform.localScale;
pos = SmoothTo(pos, GoalPosition, SolverHandler.DeltaTime, moveLerpTime);
diff --git a/org.mixedrealitytoolkit.spatialmanipulation/package.json b/org.mixedrealitytoolkit.spatialmanipulation/package.json
index bc2cdd16a..1656b5f77 100644
--- a/org.mixedrealitytoolkit.spatialmanipulation/package.json
+++ b/org.mixedrealitytoolkit.spatialmanipulation/package.json
@@ -18,6 +18,7 @@
"documentationUrl": "https://www.mixedrealitytoolkit.org",
"dependencies": {
"org.mixedrealitytoolkit.core": "4.0.0",
+ "org.mixedrealitytoolkit.input": "4.0.0",
"org.mixedrealitytoolkit.uxcore": "4.0.0",
"com.unity.inputsystem": "1.6.1",
"com.unity.xr.interaction.toolkit": "3.0.4"
@@ -28,4 +29,4 @@
"msftTestPackages": {
"org.mixedrealitytoolkit.input": "4.0.0"
}
-}
+}
\ No newline at end of file