Skip to content

Commit 0a35a4b

Browse files
committed
Add HL1 hand for XR SDK
1 parent 0c0861b commit 0a35a4b

File tree

6 files changed

+244
-6
lines changed

6 files changed

+244
-6
lines changed

Assets/MixedRealityToolkit.Examples/Demos/Input/Scenes/InputActions/InputActions.MixedRealityControllerMappingProfile.asset

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -709,6 +709,99 @@ MonoBehaviour:
709709
axisCodeY:
710710
invertXAxis: 0
711711
invertYAxis: 0
712+
- controllerType:
713+
reference: Microsoft.MixedReality.Toolkit.XRSDK.WindowsMixedReality.WindowsMixedRealityXRSDKGGVHand,
714+
Microsoft.MixedReality.Toolkit.Providers.XRSDK.WindowsMixedReality
715+
handedness: 0
716+
interactions:
717+
- id: 0
718+
description: Select
719+
axisType: 2
720+
inputType: 25
721+
inputAction:
722+
id: 1
723+
description: Select
724+
axisConstraint: 2
725+
keyCode: 0
726+
axisCodeX:
727+
axisCodeY:
728+
invertXAxis: 0
729+
invertYAxis: 0
730+
- id: 1
731+
description: Grip Pose
732+
axisType: 7
733+
inputType: 14
734+
inputAction:
735+
id: 3
736+
description: Grip Pose
737+
axisConstraint: 7
738+
keyCode: 0
739+
axisCodeX:
740+
axisCodeY:
741+
invertXAxis: 0
742+
invertYAxis: 0
743+
- controllerType:
744+
reference: Microsoft.MixedReality.Toolkit.XRSDK.WindowsMixedReality.WindowsMixedRealityXRSDKGGVHand,
745+
Microsoft.MixedReality.Toolkit.Providers.XRSDK.WindowsMixedReality
746+
handedness: 1
747+
interactions:
748+
- id: 0
749+
description: Select
750+
axisType: 2
751+
inputType: 25
752+
inputAction:
753+
id: 1
754+
description: Select
755+
axisConstraint: 2
756+
keyCode: 0
757+
axisCodeX:
758+
axisCodeY:
759+
invertXAxis: 0
760+
invertYAxis: 0
761+
- id: 1
762+
description: Grip Pose
763+
axisType: 7
764+
inputType: 14
765+
inputAction:
766+
id: 3
767+
description: Grip Pose
768+
axisConstraint: 7
769+
keyCode: 0
770+
axisCodeX:
771+
axisCodeY:
772+
invertXAxis: 0
773+
invertYAxis: 0
774+
- controllerType:
775+
reference: Microsoft.MixedReality.Toolkit.XRSDK.WindowsMixedReality.WindowsMixedRealityXRSDKGGVHand,
776+
Microsoft.MixedReality.Toolkit.Providers.XRSDK.WindowsMixedReality
777+
handedness: 2
778+
interactions:
779+
- id: 0
780+
description: Select
781+
axisType: 2
782+
inputType: 25
783+
inputAction:
784+
id: 1
785+
description: Select
786+
axisConstraint: 2
787+
keyCode: 0
788+
axisCodeX:
789+
axisCodeY:
790+
invertXAxis: 0
791+
invertYAxis: 0
792+
- id: 1
793+
description: Grip Pose
794+
axisType: 7
795+
inputType: 14
796+
inputAction:
797+
id: 3
798+
description: Grip Pose
799+
axisConstraint: 7
800+
keyCode: 0
801+
axisCodeX:
802+
axisCodeY:
803+
invertXAxis: 0
804+
invertYAxis: 0
712805
- controllerType:
713806
reference: Microsoft.MixedReality.Toolkit.XRSDK.WindowsMixedReality.WindowsMixedRealityXRSDKMotionController,
714807
Microsoft.MixedReality.Toolkit.Providers.XRSDK.WindowsMixedReality

Assets/MixedRealityToolkit.Providers/WindowsMixedReality/XR2018/Controllers/WindowsMixedRealityGGVHand.cs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,18 @@
77
namespace Microsoft.MixedReality.Toolkit.WindowsMixedReality.Input
88
{
99
/// <summary>
10-
/// A Windows Mixed Reality Controller Instance.
10+
/// A Windows Mixed Reality GGV hand instance.
1111
/// </summary>
1212
[MixedRealityController(
1313
SupportedControllerType.GGVHand,
1414
new[] { Handedness.Left, Handedness.Right, Handedness.None })]
1515
public class WindowsMixedRealityGGVHand : BaseWindowsMixedRealitySource
1616
{
1717
public WindowsMixedRealityGGVHand(TrackingState trackingState, Handedness controllerHandedness, IMixedRealityInputSource inputSource = null, MixedRealityInteractionMapping[] interactions = null)
18-
: base(trackingState, controllerHandedness, inputSource, interactions)
19-
{
20-
}
18+
: base(trackingState, controllerHandedness, inputSource, interactions) { }
2119

2220
/// <summary>
23-
/// The GGV hand default interactions
21+
/// The GGV hand default interactions.
2422
/// </summary>
2523
/// <remarks>A single interaction mapping works for both left and right controllers.</remarks>
2624
public override MixedRealityInteractionMapping[] DefaultInteractions { get; } = new[]
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
// Copyright (c) Microsoft Corporation.
2+
// Licensed under the MIT License.
3+
4+
using Microsoft.MixedReality.Toolkit.Input;
5+
using Microsoft.MixedReality.Toolkit.Utilities;
6+
7+
namespace Microsoft.MixedReality.Toolkit.XRSDK.WindowsMixedReality
8+
{
9+
/// <summary>
10+
/// A Windows Mixed Reality GGV hand instance for XR SDK.
11+
/// </summary>
12+
[MixedRealityController(
13+
SupportedControllerType.GGVHand,
14+
new[] { Handedness.Left, Handedness.Right, Handedness.None })]
15+
public class WindowsMixedRealityXRSDKGGVHand : BaseWindowsMixedRealityXRSDKSource
16+
{
17+
public WindowsMixedRealityXRSDKGGVHand(TrackingState trackingState, Handedness controllerHandedness, IMixedRealityInputSource inputSource = null, MixedRealityInteractionMapping[] interactions = null)
18+
: base(trackingState, controllerHandedness, inputSource, interactions) { }
19+
20+
/// <summary>
21+
/// The GGV hand default interactions.
22+
/// </summary>
23+
/// <remarks>A single interaction mapping works for both left and right controllers.</remarks>
24+
public override MixedRealityInteractionMapping[] DefaultInteractions { get; } = new[]
25+
{
26+
new MixedRealityInteractionMapping(0, "Select", AxisType.Digital, DeviceInputType.Select),
27+
new MixedRealityInteractionMapping(1, "Grip Pose", AxisType.SixDof, DeviceInputType.SpatialGrip),
28+
};
29+
}
30+
}

Assets/MixedRealityToolkit.Providers/WindowsMixedReality/XRSDK/Controllers/WindowsMixedRealityXRSDKGGVHand.cs.meta

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Assets/MixedRealityToolkit.Providers/WindowsMixedReality/XRSDK/WindowsMixedRealityDeviceManager.cs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,8 @@ protected override Type GetControllerType(SupportedControllerType supportedContr
102102
return typeof(WindowsMixedRealityXRSDKMotionController);
103103
case SupportedControllerType.ArticulatedHand:
104104
return typeof(WindowsMixedRealityXRSDKArticulatedHand);
105+
case SupportedControllerType.GGVHand:
106+
return typeof(WindowsMixedRealityXRSDKGGVHand);
105107
default:
106108
return base.GetControllerType(supportedControllerType);
107109
}
@@ -115,6 +117,7 @@ protected override InputSourceType GetInputSourceType(SupportedControllerType su
115117
case SupportedControllerType.WindowsMixedReality:
116118
return InputSourceType.Controller;
117119
case SupportedControllerType.ArticulatedHand:
120+
case SupportedControllerType.GGVHand:
118121
return InputSourceType.Hand;
119122
default:
120123
return base.GetInputSourceType(supportedControllerType);
@@ -126,7 +129,17 @@ protected override SupportedControllerType GetCurrentControllerType(InputDevice
126129
{
127130
if (inputDevice.characteristics.HasFlag(InputDeviceCharacteristics.HandTracking))
128131
{
129-
return SupportedControllerType.ArticulatedHand;
132+
if (inputDevice.characteristics.HasFlag(InputDeviceCharacteristics.Left) ||
133+
inputDevice.characteristics.HasFlag(InputDeviceCharacteristics.Right))
134+
{
135+
// If it's a hand with a reported handedness, assume HL2 articulated hand
136+
return SupportedControllerType.ArticulatedHand;
137+
}
138+
else
139+
{
140+
// Otherwise, assume HL1 hand
141+
return SupportedControllerType.GGVHand;
142+
}
130143
}
131144

132145
if (inputDevice.characteristics.HasFlag(InputDeviceCharacteristics.Controller))

Assets/MixedRealityToolkit.SDK/Profiles/DefaultMixedRealityControllerMappingProfile.asset

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -709,6 +709,99 @@ MonoBehaviour:
709709
axisCodeY:
710710
invertXAxis: 0
711711
invertYAxis: 0
712+
- controllerType:
713+
reference: Microsoft.MixedReality.Toolkit.XRSDK.WindowsMixedReality.WindowsMixedRealityXRSDKGGVHand,
714+
Microsoft.MixedReality.Toolkit.Providers.XRSDK.WindowsMixedReality
715+
handedness: 0
716+
interactions:
717+
- id: 0
718+
description: Select
719+
axisType: 2
720+
inputType: 25
721+
inputAction:
722+
id: 1
723+
description: Select
724+
axisConstraint: 2
725+
keyCode: 0
726+
axisCodeX:
727+
axisCodeY:
728+
invertXAxis: 0
729+
invertYAxis: 0
730+
- id: 1
731+
description: Grip Pose
732+
axisType: 7
733+
inputType: 14
734+
inputAction:
735+
id: 3
736+
description: Grip Pose
737+
axisConstraint: 7
738+
keyCode: 0
739+
axisCodeX:
740+
axisCodeY:
741+
invertXAxis: 0
742+
invertYAxis: 0
743+
- controllerType:
744+
reference: Microsoft.MixedReality.Toolkit.XRSDK.WindowsMixedReality.WindowsMixedRealityXRSDKGGVHand,
745+
Microsoft.MixedReality.Toolkit.Providers.XRSDK.WindowsMixedReality
746+
handedness: 1
747+
interactions:
748+
- id: 0
749+
description: Select
750+
axisType: 2
751+
inputType: 25
752+
inputAction:
753+
id: 1
754+
description: Select
755+
axisConstraint: 2
756+
keyCode: 0
757+
axisCodeX:
758+
axisCodeY:
759+
invertXAxis: 0
760+
invertYAxis: 0
761+
- id: 1
762+
description: Grip Pose
763+
axisType: 7
764+
inputType: 14
765+
inputAction:
766+
id: 3
767+
description: Grip Pose
768+
axisConstraint: 7
769+
keyCode: 0
770+
axisCodeX:
771+
axisCodeY:
772+
invertXAxis: 0
773+
invertYAxis: 0
774+
- controllerType:
775+
reference: Microsoft.MixedReality.Toolkit.XRSDK.WindowsMixedReality.WindowsMixedRealityXRSDKGGVHand,
776+
Microsoft.MixedReality.Toolkit.Providers.XRSDK.WindowsMixedReality
777+
handedness: 2
778+
interactions:
779+
- id: 0
780+
description: Select
781+
axisType: 2
782+
inputType: 25
783+
inputAction:
784+
id: 1
785+
description: Select
786+
axisConstraint: 2
787+
keyCode: 0
788+
axisCodeX:
789+
axisCodeY:
790+
invertXAxis: 0
791+
invertYAxis: 0
792+
- id: 1
793+
description: Grip Pose
794+
axisType: 7
795+
inputType: 14
796+
inputAction:
797+
id: 3
798+
description: Grip Pose
799+
axisConstraint: 7
800+
keyCode: 0
801+
axisCodeX:
802+
axisCodeY:
803+
invertXAxis: 0
804+
invertYAxis: 0
712805
- controllerType:
713806
reference: Microsoft.MixedReality.Toolkit.XRSDK.WindowsMixedReality.WindowsMixedRealityXRSDKMotionController,
714807
Microsoft.MixedReality.Toolkit.Providers.XRSDK.WindowsMixedReality

0 commit comments

Comments
 (0)