Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Leap Motion Data Provider #7639

Merged
merged 21 commits into from
Apr 20, 2020
Merged
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
5190842
Initial Leap Motion Data Provider work
CDiaz-MS Apr 10, 2020
8407676
Merge remote-tracking branch 'upstream/mrtk_development' into mrtk_le…
CDiaz-MS Apr 10, 2020
0360a35
Reapply profiler changes to ArticulatedHandDefinition
CDiaz-MS Apr 10, 2020
07aacf2
Added comments, set isCustomProfile:0 in profiles, removed empty refe…
CDiaz-MS Apr 10, 2020
925bb1c
Add AssemblyInfo files to MRTK/Providers/LeapMotion
CDiaz-MS Apr 10, 2020
44cb811
Update documentation and LeapMotionConfigurationChecker based on feed…
CDiaz-MS Apr 13, 2020
ea4360d
Added more example errors to Common Errors section in the documentation
CDiaz-MS Apr 14, 2020
498638d
Reserialize DefaultControllerMappingProfile to include the XRSDK types
CDiaz-MS Apr 14, 2020
4abb8aa
Updated Leap Profile Inspector, comments in the LeapControllerOrienta…
CDiaz-MS Apr 15, 2020
1605f3a
Add Leap Core Assets Version check to Leap Configuration Checker
CDiaz-MS Apr 15, 2020
dbcdd10
Updated the Device Manager and the Leap Hand based on feedback and ad…
CDiaz-MS Apr 15, 2020
fe94f67
Add missing comment to Configuration Checker
CDiaz-MS Apr 15, 2020
46b8230
Fix link in Documentation
CDiaz-MS Apr 15, 2020
556425a
Change MRTK to lowercase mrtk in doc link
CDiaz-MS Apr 15, 2020
3cf4d9a
Add Reserialized InputAction.ControllerMappingProfile asset
CDiaz-MS Apr 16, 2020
27d3584
Updates to Leap Hand and the Device Manager based on Kurtis feedback
CDiaz-MS Apr 17, 2020
8855732
Move TryGetJoint outside of LEAPMOTIONCORE_PRESENT
CDiaz-MS Apr 17, 2020
917ea92
Updated documentation based on feedback, added additional threshold f…
CDiaz-MS Apr 17, 2020
19728f8
Updates to Config Checker and Device Manager, also added comments to …
CDiaz-MS Apr 20, 2020
a1a293f
Fix null ref guard for leap attachment hand on Disable cleanup
CDiaz-MS Apr 20, 2020
26e4dbd
Changed some properties from public to private, moved documentation r…
CDiaz-MS Apr 20, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Assets/MRTK/Core/Definitions/Devices/DeviceInputType.cs
Original file line number Diff line number Diff line change
@@ -32,6 +32,7 @@ public enum DeviceInputType
Trigger,
TriggerTouch,
TriggerNearTouch,
// TriggerPress, in some cases, maps to the Grab gesture.
TriggerPress,
/// <summary>
/// 6 DoF Grip with position and rotation.
@@ -53,6 +54,9 @@ public enum DeviceInputType
TouchpadTouch,
TouchpadNearTouch,
TouchpadPress,
/// <summary>
/// Select maps to the Pinch/Air Tap gesture
/// </summary>
Select,
Start,
Menu,
37 changes: 37 additions & 0 deletions Assets/MRTK/Core/Providers/Hands/ArticulatedHandDefinition.cs
Original file line number Diff line number Diff line change
@@ -28,6 +28,12 @@ public ArticulatedHandDefinition(IMixedRealityInputSource source, Handedness han
private Dictionary<TrackedHandJoint, MixedRealityPose> unityJointPoses = new Dictionary<TrackedHandJoint, MixedRealityPose>();
private MixedRealityPose currentIndexPose = MixedRealityPose.ZeroIdentity;

// Pinch distance thresholds
private readonly float enterPinchDistance = 0.02f;
private readonly float exitPinchDistance = 0.05f;

private bool isPinching = false;

/// <summary>
/// The articulated hands default interactions.
/// </summary>
@@ -72,6 +78,37 @@ public bool IsInPointingPose
}
}

/// <summary>
/// Calculates whether the current the current joint pose is selecting (air tap gesture).
/// </summary>
public bool IsPinching
{
get
{
MixedRealityPose thumbTip;
MixedRealityPose indexTip;
if (unityJointPoses.TryGetValue(TrackedHandJoint.ThumbTip, out thumbTip) && unityJointPoses.TryGetValue(TrackedHandJoint.IndexTip, out indexTip))
{
float distance = Vector3.Distance(thumbTip.Position, indexTip.Position);

if (isPinching && distance > exitPinchDistance)
{
isPinching = false;
}
else if (!isPinching && distance < enterPinchDistance)
{
isPinching = true;
}
}
else
{
isPinching = false;
}

return isPinching;
}
}

/// <summary>
/// Updates the current hand joints with new data.
/// </summary>
Loading