diff --git a/Packages/Tracking/CHANGELOG.md b/Packages/Tracking/CHANGELOG.md index b449419b9..47ba4a76b 100644 --- a/Packages/Tracking/CHANGELOG.md +++ b/Packages/Tracking/CHANGELOG.md @@ -15,6 +15,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Fixed some warnings around runtime variables that were only used in editor mode - Fixed an issue with Physical Hands and Unity 6 due to the physics Contact Generation setting being removed - (UI Input Preview) Added explicit missing dependancy on the "Unity UI" package +- Clients were not able to subscribe to the events on the PinchDetector and GrabDetector scripts as the properties were exposed as readonly. +- GrabDetector detection logic was inverted, so open hands were interpreted as grabs. Now fixed. ### Changed - Updated all custom shaders to support the Universal Render Pipeline concurrently with the Built-in Render Pipeline diff --git a/Packages/Tracking/Core/Runtime/Scripts/ActionDetectors/GrabDetector.cs b/Packages/Tracking/Core/Runtime/Scripts/ActionDetectors/GrabDetector.cs index b977e04fe..f78ae226d 100644 --- a/Packages/Tracking/Core/Runtime/Scripts/ActionDetectors/GrabDetector.cs +++ b/Packages/Tracking/Core/Runtime/Scripts/ActionDetectors/GrabDetector.cs @@ -34,9 +34,26 @@ public class GrabDetector : ActionDetector public bool IsGrabbing => IsDoingAction; // Accessor actions for readability - public Action OnGrabStart => onActionStart; - public Action OnGrabEnd => onActionEnd; - public Action OnGrabbing => onAction; + public Action OnGrabStart + { + get => onActionStart; + + set => onActionStart = value; + } + + public Action OnGrabEnd + { + get => onActionEnd; + + set => onActionEnd = value; + } + + public Action OnGrabbing + { + get => onAction; + + set => onAction = value; + } /// /// Updates the grab status based on the hand data. @@ -50,7 +67,8 @@ protected override void UpdateActionStatus(Hand _hand) } float _grabStrength = _hand.GrabStrength; - if (_grabStrength < activateStrength) + + if (_grabStrength > activateStrength) { if (!IsDoingAction) { @@ -64,7 +82,7 @@ protected override void UpdateActionStatus(Hand _hand) IsDoingAction = true; } - else if (_grabStrength > deactivateStrength) + else if (_grabStrength < deactivateStrength) { if (IsDoingAction) { diff --git a/Packages/Tracking/Core/Runtime/Scripts/ActionDetectors/PinchDetector.cs b/Packages/Tracking/Core/Runtime/Scripts/ActionDetectors/PinchDetector.cs index 418a8afd8..ad8965837 100644 --- a/Packages/Tracking/Core/Runtime/Scripts/ActionDetectors/PinchDetector.cs +++ b/Packages/Tracking/Core/Runtime/Scripts/ActionDetectors/PinchDetector.cs @@ -55,9 +55,27 @@ public enum PinchableFingerType public bool IsPinching => IsDoingAction; // Accessor actions for readability - public Action OnPinchStart => onActionStart; - public Action OnPinchEnd => onActionEnd; - public Action OnPinching => onAction; + public Action OnPinchStart + { + get => onActionStart; + + set => onActionStart = value; + } + + public Action OnPinchEnd + { + get => onActionEnd; + + set => onActionEnd = value; + + } + + public Action OnPinching + { + get => onAction; + + set => onAction = value; + } /// /// Updates the pinch status based on the hand data.