From a42ff77bd4ad037ab1f90bd84274c1170a753963 Mon Sep 17 00:00:00 2001 From: Stephen Hodgson Date: Mon, 6 Apr 2020 13:35:33 -0400 Subject: [PATCH 01/62] updated wmr controller data provider --- .../WindowsMixedRealityController.cs | 24 +++++------ ...MotionControllerMappingProfileInspector.cs | 24 +++++------ ...xedRealityControllerDataProviderProfile.cs | 15 ++++++- ...edRealityMotionControllerMappingProfile.cs | 40 ------------------- ...lityMotionControllerMappingProfile.cs.meta | 11 ----- 5 files changed, 38 insertions(+), 76 deletions(-) delete mode 100644 XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Profiles/WindowsMixedRealityMotionControllerMappingProfile.cs delete mode 100644 XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Profiles/WindowsMixedRealityMotionControllerMappingProfile.cs.meta diff --git a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Controllers/WindowsMixedRealityController.cs b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Controllers/WindowsMixedRealityController.cs index 0dc6c6e..4466990 100644 --- a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Controllers/WindowsMixedRealityController.cs +++ b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Controllers/WindowsMixedRealityController.cs @@ -39,18 +39,18 @@ public WindowsMixedRealityController(TrackingState trackingState, Handedness con /// A single interaction mapping works for both left and right controllers. public override MixedRealityInteractionMapping[] DefaultInteractions => new[] { - new MixedRealityInteractionMapping(0, "Spatial Pointer", AxisType.SixDof, DeviceInputType.SpatialPointer, MixedRealityInputAction.None), - new MixedRealityInteractionMapping(1, "Spatial Grip", AxisType.SixDof, DeviceInputType.SpatialGrip, MixedRealityInputAction.None), - new MixedRealityInteractionMapping(2, "Grip Press", AxisType.SingleAxis, DeviceInputType.TriggerPress, MixedRealityInputAction.None), - new MixedRealityInteractionMapping(3, "Trigger Position", AxisType.SingleAxis, DeviceInputType.Trigger, MixedRealityInputAction.None), - new MixedRealityInteractionMapping(4, "Trigger Touched", AxisType.Digital, DeviceInputType.TriggerTouch, MixedRealityInputAction.None), - new MixedRealityInteractionMapping(5, "Trigger Press (Select)", AxisType.Digital, DeviceInputType.Select, MixedRealityInputAction.None), - new MixedRealityInteractionMapping(6, "Touchpad Position", AxisType.DualAxis, DeviceInputType.Touchpad, MixedRealityInputAction.None), - new MixedRealityInteractionMapping(7, "Touchpad Touch", AxisType.Digital, DeviceInputType.TouchpadTouch, MixedRealityInputAction.None), - new MixedRealityInteractionMapping(8, "Touchpad Press", AxisType.Digital, DeviceInputType.TouchpadPress, MixedRealityInputAction.None), - new MixedRealityInteractionMapping(9, "Menu Press", AxisType.Digital, DeviceInputType.Menu, MixedRealityInputAction.None), - new MixedRealityInteractionMapping(10, "Thumbstick Position", AxisType.DualAxis, DeviceInputType.ThumbStick, MixedRealityInputAction.None), - new MixedRealityInteractionMapping(11, "Thumbstick Press", AxisType.Digital, DeviceInputType.ThumbStickPress, MixedRealityInputAction.None), + new MixedRealityInteractionMapping("Spatial Pointer", AxisType.SixDof, DeviceInputType.SpatialPointer, MixedRealityInputAction.None), + new MixedRealityInteractionMapping("Spatial Grip", AxisType.SixDof, DeviceInputType.SpatialGrip, MixedRealityInputAction.None), + new MixedRealityInteractionMapping("Grip Press", AxisType.SingleAxis, DeviceInputType.TriggerPress, MixedRealityInputAction.None), + new MixedRealityInteractionMapping("Trigger Position", AxisType.SingleAxis, DeviceInputType.Trigger, MixedRealityInputAction.None), + new MixedRealityInteractionMapping("Trigger Touched", AxisType.Digital, DeviceInputType.TriggerTouch, MixedRealityInputAction.None), + new MixedRealityInteractionMapping("Trigger Press (Select)", AxisType.Digital, DeviceInputType.Select, MixedRealityInputAction.None), + new MixedRealityInteractionMapping("Touchpad Position", AxisType.DualAxis, DeviceInputType.Touchpad, MixedRealityInputAction.None), + new MixedRealityInteractionMapping("Touchpad Touch", AxisType.Digital, DeviceInputType.TouchpadTouch, MixedRealityInputAction.None), + new MixedRealityInteractionMapping("Touchpad Press", AxisType.Digital, DeviceInputType.TouchpadPress, MixedRealityInputAction.None), + new MixedRealityInteractionMapping("Menu Press", AxisType.Digital, DeviceInputType.Menu, MixedRealityInputAction.None), + new MixedRealityInteractionMapping("Thumbstick Position", AxisType.DualAxis, DeviceInputType.ThumbStick, MixedRealityInputAction.None), + new MixedRealityInteractionMapping("Thumbstick Press", AxisType.Digital, DeviceInputType.ThumbStickPress, MixedRealityInputAction.None), }; /// diff --git a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Inspectors/WindowsMixedRealityMotionControllerMappingProfileInspector.cs b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Inspectors/WindowsMixedRealityMotionControllerMappingProfileInspector.cs index 1ce9782..4368cca 100644 --- a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Inspectors/WindowsMixedRealityMotionControllerMappingProfileInspector.cs +++ b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Inspectors/WindowsMixedRealityMotionControllerMappingProfileInspector.cs @@ -1,14 +1,14 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See LICENSE in the project root for license information. +//// Copyright (c) Microsoft Corporation. All rights reserved. +//// Licensed under the MIT License. See LICENSE in the project root for license information. -using UnityEditor; -using XRTK.Inspectors.Profiles.InputSystem.Controllers; -using XRTK.WindowsMixedReality.Profiles; +//using UnityEditor; +//using XRTK.Inspectors.Profiles.InputSystem.Controllers; +//using XRTK.WindowsMixedReality.Profiles; -namespace XRTK.WindowsMixedReality.Inspectors -{ - [CustomEditor(typeof(WindowsMixedRealityMotionControllerMappingProfile))] - public class WindowsMixedRealityMotionControllerMappingProfileInspector : BaseMixedRealityControllerMappingProfileInspector - { - } -} \ No newline at end of file +//namespace XRTK.WindowsMixedReality.Inspectors +//{ +// [CustomEditor(typeof(WindowsMixedRealityMotionControllerMappingProfile))] +// public class WindowsMixedRealityMotionControllerMappingProfileInspector : BaseMixedRealityControllerMappingProfileInspector +// { +// } +//} \ No newline at end of file diff --git a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Profiles/WindowsMixedRealityControllerDataProviderProfile.cs b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Profiles/WindowsMixedRealityControllerDataProviderProfile.cs index 4a9e39e..39dd23b 100644 --- a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Profiles/WindowsMixedRealityControllerDataProviderProfile.cs +++ b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Profiles/WindowsMixedRealityControllerDataProviderProfile.cs @@ -1,4 +1,7 @@ -using UnityEngine; +// Copyright (c) XRTK. All rights reserved. +// Licensed under the MIT License. See LICENSE in the project root for license information. + +using UnityEngine; using XRTK.Attributes; using XRTK.Definitions.InputSystem; using XRTK.Definitions.Utilities; @@ -49,5 +52,15 @@ public class WindowsMixedRealityControllerDataProviderProfile : BaseMixedReality private AutoStartBehavior windowsGestureAutoStart = AutoStartBehavior.AutoStart; public AutoStartBehavior WindowsGestureAutoStart => windowsGestureAutoStart; + + public override ControllerDefinition[] GetControllerDefinitions() + { + // new MixedRealityControllerMapping("Windows Mixed Reality HoloLens Hand Input", typeof(WindowsMixedRealityController)), + // new MixedRealityControllerMapping("Windows Mixed Reality Motion Controller Left", typeof(WindowsMixedRealityController), Handedness.Left), + // new MixedRealityControllerMapping("Windows Mixed Reality Motion Controller Right", typeof(WindowsMixedRealityController), Handedness.Right), + // new MixedRealityControllerMapping("Open VR Motion Controller Left", typeof(WindowsMixedRealityOpenVRMotionController), Handedness.Left), + // new MixedRealityControllerMapping("Open VR Motion Controller Right", typeof(WindowsMixedRealityOpenVRMotionController), Handedness.Right), + throw new System.NotImplementedException(); + } } } diff --git a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Profiles/WindowsMixedRealityMotionControllerMappingProfile.cs b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Profiles/WindowsMixedRealityMotionControllerMappingProfile.cs deleted file mode 100644 index 604f723..0000000 --- a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Profiles/WindowsMixedRealityMotionControllerMappingProfile.cs +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See LICENSE in the project root for license information. - -using UnityEngine; -using XRTK.Definitions.Controllers; -using XRTK.Definitions.Devices; -using XRTK.Definitions.Utilities; -using XRTK.Providers.Controllers; -using XRTK.Providers.Controllers.OpenVR; -using XRTK.WindowsMixedReality.Controllers; - -namespace XRTK.WindowsMixedReality.Profiles -{ - [CreateAssetMenu(menuName = "Mixed Reality Toolkit/Input System/Controller Mappings/Windows Mixed Reality Controller Mapping Profile", fileName = "WindowsMixedRealityControllerMappingProfile")] - public class WindowsMixedRealityMotionControllerMappingProfile : BaseMixedRealityControllerMappingProfile - { - /// - public override SupportedControllerType ControllerType => SupportedControllerType.WindowsMixedReality; - - /// - public override string TexturePath => $"{base.TexturePath}MotionController"; - - protected override void Awake() - { - if (!HasSetupDefaults) - { - ControllerMappings = new[] - { - new MixedRealityControllerMapping("Windows Mixed Reality HoloLens Hand Input", typeof(WindowsMixedRealityController)), - new MixedRealityControllerMapping("Windows Mixed Reality Motion Controller Left", typeof(WindowsMixedRealityController), Handedness.Left), - new MixedRealityControllerMapping("Windows Mixed Reality Motion Controller Right", typeof(WindowsMixedRealityController), Handedness.Right), - new MixedRealityControllerMapping("Open VR Motion Controller Left", typeof(WindowsMixedRealityOpenVRMotionController), Handedness.Left), - new MixedRealityControllerMapping("Open VR Motion Controller Right", typeof(WindowsMixedRealityOpenVRMotionController), Handedness.Right), - }; - } - - base.Awake(); - } - } -} \ No newline at end of file diff --git a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Profiles/WindowsMixedRealityMotionControllerMappingProfile.cs.meta b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Profiles/WindowsMixedRealityMotionControllerMappingProfile.cs.meta deleted file mode 100644 index e7b1e75..0000000 --- a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Profiles/WindowsMixedRealityMotionControllerMappingProfile.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: a77269983a934c18a85a96fdff6e0ef6 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {fileID: 2800000, guid: 6e2e9d716bbb4d8382bd53f11996b90e, type: 3} - userData: - assetBundleName: - assetBundleVariant: From 23ba2a0eeff495738e53e25203d0e84d0e7a883b Mon Sep 17 00:00:00 2001 From: Stephen Hodgson Date: Mon, 6 Apr 2020 13:47:58 -0400 Subject: [PATCH 02/62] removed commented out class --- ...alityMotionControllerMappingProfileInspector.cs | 14 -------------- ...MotionControllerMappingProfileInspector.cs.meta | 11 ----------- 2 files changed, 25 deletions(-) delete mode 100644 XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Inspectors/WindowsMixedRealityMotionControllerMappingProfileInspector.cs delete mode 100644 XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Inspectors/WindowsMixedRealityMotionControllerMappingProfileInspector.cs.meta diff --git a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Inspectors/WindowsMixedRealityMotionControllerMappingProfileInspector.cs b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Inspectors/WindowsMixedRealityMotionControllerMappingProfileInspector.cs deleted file mode 100644 index 4368cca..0000000 --- a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Inspectors/WindowsMixedRealityMotionControllerMappingProfileInspector.cs +++ /dev/null @@ -1,14 +0,0 @@ -//// Copyright (c) Microsoft Corporation. All rights reserved. -//// Licensed under the MIT License. See LICENSE in the project root for license information. - -//using UnityEditor; -//using XRTK.Inspectors.Profiles.InputSystem.Controllers; -//using XRTK.WindowsMixedReality.Profiles; - -//namespace XRTK.WindowsMixedReality.Inspectors -//{ -// [CustomEditor(typeof(WindowsMixedRealityMotionControllerMappingProfile))] -// public class WindowsMixedRealityMotionControllerMappingProfileInspector : BaseMixedRealityControllerMappingProfileInspector -// { -// } -//} \ No newline at end of file diff --git a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Inspectors/WindowsMixedRealityMotionControllerMappingProfileInspector.cs.meta b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Inspectors/WindowsMixedRealityMotionControllerMappingProfileInspector.cs.meta deleted file mode 100644 index ff6e36c..0000000 --- a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Inspectors/WindowsMixedRealityMotionControllerMappingProfileInspector.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 29d5fb20be1d4120acd4fa19b95b8aeb -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {fileID: 2800000, guid: 6e2e9d716bbb4d8382bd53f11996b90e, type: 3} - userData: - assetBundleName: - assetBundleVariant: From bb9e1a42cafb882252ed53bfe08d425cb993eed6 Mon Sep 17 00:00:00 2001 From: Stephen Hodgson Date: Mon, 6 Apr 2020 22:50:45 -0400 Subject: [PATCH 03/62] added controller data provider reference to the controller --- .../Controllers/WindowsMixedRealityController.cs | 13 ++++--------- .../WindowsMixedRealityControllerDataProvider.cs | 4 ++-- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Controllers/WindowsMixedRealityController.cs b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Controllers/WindowsMixedRealityController.cs index 0dc6c6e..39169dd 100644 --- a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Controllers/WindowsMixedRealityController.cs +++ b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Controllers/WindowsMixedRealityController.cs @@ -5,6 +5,7 @@ using XRTK.Definitions.InputSystem; using XRTK.Definitions.Utilities; using XRTK.Interfaces.InputSystem; +using XRTK.Interfaces.Providers.Controllers; using XRTK.Providers.Controllers; #if UNITY_WSA @@ -21,15 +22,9 @@ namespace XRTK.WindowsMixedReality.Controllers /// public class WindowsMixedRealityController : BaseController { - /// - /// Constructor. - /// - /// - /// - /// - /// - public WindowsMixedRealityController(TrackingState trackingState, Handedness controllerHandedness, IMixedRealityInputSource inputSource = null, MixedRealityInteractionMapping[] interactions = null) - : base(trackingState, controllerHandedness, inputSource, interactions) + /// + public WindowsMixedRealityController(IMixedRealityControllerDataProvider controllerDataProvider, TrackingState trackingState, Handedness controllerHandedness, IMixedRealityInputSource inputSource = null, MixedRealityInteractionMapping[] interactions = null) + : base(controllerDataProvider, trackingState, controllerHandedness, inputSource, interactions) { } diff --git a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Controllers/WindowsMixedRealityControllerDataProvider.cs b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Controllers/WindowsMixedRealityControllerDataProvider.cs index dfe3939..3789606 100644 --- a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Controllers/WindowsMixedRealityControllerDataProvider.cs +++ b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Controllers/WindowsMixedRealityControllerDataProvider.cs @@ -420,7 +420,7 @@ private WindowsMixedRealityController GetController(InteractionSource interactio var pointers = interactionSource.supportsPointing ? RequestPointers(typeof(WindowsMixedRealityController), controllingHand) : null; var nameModifier = controllingHand == Handedness.None ? interactionSource.kind.ToString() : controllingHand.ToString(); var inputSource = MixedRealityToolkit.InputSystem?.RequestNewGenericInputSource($"Mixed Reality Controller {nameModifier}", pointers); - var detectedController = new WindowsMixedRealityController(TrackingState.NotApplicable, controllingHand, inputSource); + var detectedController = new WindowsMixedRealityController(this, TrackingState.NotApplicable, controllingHand, inputSource); if (!detectedController.SetupConfiguration(typeof(WindowsMixedRealityController))) { @@ -505,11 +505,11 @@ private void RemoveController(InteractionSourceState interactionSourceState, boo if (controller != null) { MixedRealityToolkit.InputSystem?.RaiseSourceLost(controller.InputSource, controller); - RemoveController(controller); } if (clearFromRegistry) { + RemoveController(controller); activeControllers.Remove(interactionSourceState.source.id); } } From 9bc7dab848906eb25f0af63f4f0d8a1d188f1e43 Mon Sep 17 00:00:00 2001 From: Stephen Hodgson Date: Tue, 7 Apr 2020 00:29:05 -0400 Subject: [PATCH 04/62] updated references --- .../com.xrtk.wmr/Controllers/WindowsMixedRealityController.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Controllers/WindowsMixedRealityController.cs b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Controllers/WindowsMixedRealityController.cs index 4698691..b94d857 100644 --- a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Controllers/WindowsMixedRealityController.cs +++ b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Controllers/WindowsMixedRealityController.cs @@ -1,12 +1,12 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See LICENSE in the project root for license information. +using XRTK.Definitions.Controllers; using XRTK.Definitions.Devices; using XRTK.Definitions.InputSystem; using XRTK.Definitions.Utilities; using XRTK.Interfaces.InputSystem; using XRTK.Interfaces.Providers.Controllers; -using XRTK.Providers.Controllers; #if UNITY_WSA using UnityEngine; From e7eab33a34ca2a1156c3e84168dcb6d6878a1eb1 Mon Sep 17 00:00:00 2001 From: Stephen Hodgson Date: Tue, 7 Apr 2020 13:31:44 -0400 Subject: [PATCH 05/62] fixed references --- .../WindowsMixedRealityHandControllerDataProvider.cs | 5 +---- .../WindowsMixedRealityHandControllerDataProviderProfile.cs | 5 +++++ 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Controllers/WindowsMixedRealityHandControllerDataProvider.cs b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Controllers/WindowsMixedRealityHandControllerDataProvider.cs index d3d8ca7..2ff52b1 100644 --- a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Controllers/WindowsMixedRealityHandControllerDataProvider.cs +++ b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Controllers/WindowsMixedRealityHandControllerDataProvider.cs @@ -230,10 +230,7 @@ private MixedRealityHandController CreateController(SpatialInteractionSource spa MixedRealityToolkit.InputSystem?.RaiseSourceDetected(detectedController.InputSource, detectedController); - if (MixedRealityToolkit.Instance.ActiveProfile.InputSystemProfile.ControllerVisualizationProfile.RenderMotionControllers) - { - detectedController.TryRenderControllerModel(controllerType); - } + detectedController.TryRenderControllerModel(controllerType); AddController(detectedController); activeControllers.Add(controllingHand, detectedController); diff --git a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Profiles/WindowsMixedRealityHandControllerDataProviderProfile.cs b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Profiles/WindowsMixedRealityHandControllerDataProviderProfile.cs index b1e7ffb..47d86de 100644 --- a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Profiles/WindowsMixedRealityHandControllerDataProviderProfile.cs +++ b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Profiles/WindowsMixedRealityHandControllerDataProviderProfile.cs @@ -2,6 +2,7 @@ // Licensed under the MIT License. See LICENSE in the project root for license information. using UnityEngine; +using XRTK.Definitions.Controllers; using XRTK.Definitions.Utilities; using XRTK.Definitions.Controllers.Hands; @@ -10,5 +11,9 @@ namespace XRTK.WindowsMixedReality.Profiles [CreateAssetMenu(menuName = "Mixed Reality Toolkit/Input System/Controller Data Providers/Windows Mixed Reality Hand", fileName = "WindowsMixedRealityHandControllerDataProviderProfile", order = (int)CreateProfileMenuItemIndices.Input)] public class WindowsMixedRealityHandControllerDataProviderProfile : BaseHandControllerDataProviderProfile { + public override ControllerDefinition[] GetControllerDefinitions() + { + throw new System.NotImplementedException(); + } } } \ No newline at end of file From 91d54fe6cdecce2446e26272cc220b92bc3d7a3a Mon Sep 17 00:00:00 2001 From: Stephen Hodgson Date: Tue, 7 Apr 2020 15:17:49 -0400 Subject: [PATCH 06/62] Added default controller definitions --- ...sMixedRealityControllerDataProviderProfile.cs | 16 +++++++++------- ...edRealityHandControllerDataProviderProfile.cs | 8 -------- 2 files changed, 9 insertions(+), 15 deletions(-) diff --git a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Profiles/WindowsMixedRealityControllerDataProviderProfile.cs b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Profiles/WindowsMixedRealityControllerDataProviderProfile.cs index 69b72ae..2e6fe92 100644 --- a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Profiles/WindowsMixedRealityControllerDataProviderProfile.cs +++ b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Profiles/WindowsMixedRealityControllerDataProviderProfile.cs @@ -6,6 +6,8 @@ using XRTK.Definitions.InputSystem; using XRTK.Definitions.Utilities; using XRTK.Definitions.Controllers; +using XRTK.Definitions.Controllers.OpenVR; +using XRTK.WindowsMixedReality.Controllers; namespace XRTK.WindowsMixedReality.Profiles { @@ -53,14 +55,14 @@ public class WindowsMixedRealityControllerDataProviderProfile : BaseMixedReality public AutoStartBehavior WindowsGestureAutoStart => windowsGestureAutoStart; - public override ControllerDefinition[] GetControllerDefinitions() + public override ControllerDefinition[] GetDefaultControllerOptions() { - // new MixedRealityControllerMapping("Windows Mixed Reality HoloLens Hand Input", typeof(WindowsMixedRealityController)), - // new MixedRealityControllerMapping("Windows Mixed Reality Motion Controller Left", typeof(WindowsMixedRealityController), Handedness.Left), - // new MixedRealityControllerMapping("Windows Mixed Reality Motion Controller Right", typeof(WindowsMixedRealityController), Handedness.Right), - // new MixedRealityControllerMapping("Open VR Motion Controller Left", typeof(WindowsMixedRealityOpenVRMotionController), Handedness.Left), - // new MixedRealityControllerMapping("Open VR Motion Controller Right", typeof(WindowsMixedRealityOpenVRMotionController), Handedness.Right), - throw new System.NotImplementedException(); + return new[] + { + new ControllerDefinition(typeof(WindowsMixedRealityController)), + new ControllerDefinition(typeof(WindowsMixedRealityController), Handedness.Left), + new ControllerDefinition(typeof(WindowsMixedRealityController), Handedness.Right), + }; } } } \ No newline at end of file diff --git a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Profiles/WindowsMixedRealityHandControllerDataProviderProfile.cs b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Profiles/WindowsMixedRealityHandControllerDataProviderProfile.cs index 47d86de..93717af 100644 --- a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Profiles/WindowsMixedRealityHandControllerDataProviderProfile.cs +++ b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Profiles/WindowsMixedRealityHandControllerDataProviderProfile.cs @@ -1,19 +1,11 @@ // Copyright (c) XRTK. All rights reserved. // Licensed under the MIT License. See LICENSE in the project root for license information. -using UnityEngine; -using XRTK.Definitions.Controllers; -using XRTK.Definitions.Utilities; using XRTK.Definitions.Controllers.Hands; namespace XRTK.WindowsMixedReality.Profiles { - [CreateAssetMenu(menuName = "Mixed Reality Toolkit/Input System/Controller Data Providers/Windows Mixed Reality Hand", fileName = "WindowsMixedRealityHandControllerDataProviderProfile", order = (int)CreateProfileMenuItemIndices.Input)] public class WindowsMixedRealityHandControllerDataProviderProfile : BaseHandControllerDataProviderProfile { - public override ControllerDefinition[] GetControllerDefinitions() - { - throw new System.NotImplementedException(); - } } } \ No newline at end of file From c2e679f08cc5e909e283358afcb853f557223dea Mon Sep 17 00:00:00 2001 From: Stephen Hodgson Date: Tue, 7 Apr 2020 23:50:05 -0400 Subject: [PATCH 07/62] updated the controller data provider inspector fixed naming for controller definition --- ...edRealityControllerDataProviderProfileInspector.cs | 11 ++++------- ...indowsMixedRealityControllerDataProviderProfile.cs | 3 +-- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Inspectors/WindowsMixedRealityControllerDataProviderProfileInspector.cs b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Inspectors/WindowsMixedRealityControllerDataProviderProfileInspector.cs index 75f4f9f..44afc97 100644 --- a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Inspectors/WindowsMixedRealityControllerDataProviderProfileInspector.cs +++ b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Inspectors/WindowsMixedRealityControllerDataProviderProfileInspector.cs @@ -2,13 +2,13 @@ // Licensed under the MIT License. See LICENSE in the project root for license information. using UnityEditor; -using XRTK.Inspectors.Profiles; +using XRTK.Inspectors.Profiles.InputSystem.Controllers; using XRTK.WindowsMixedReality.Profiles; namespace XRTK.WindowsMixedReality.Inspectors { [CustomEditor(typeof(WindowsMixedRealityControllerDataProviderProfile))] - public class WindowsMixedRealityControllerDataProviderProfileInspector : BaseMixedRealityProfileInspector + public class WindowsMixedRealityControllerDataProviderProfileInspector : BaseMixedRealityControllerDataProviderProfileInspector { private SerializedProperty manipulationGestures; private SerializedProperty useRailsNavigation; @@ -29,15 +29,12 @@ protected override void OnEnable() public override void OnInspectorGUI() { - RenderHeader(); - - EditorGUILayout.Space(); - EditorGUILayout.LabelField("Windows Mixed Reality Controller Data Provider Settings", EditorStyles.boldLabel); - EditorGUILayout.HelpBox("This profile aids in configuring additional platform settings for the registered controller data provider. This can be anything from additional gestures or platform specific settings.", MessageType.Info); + base.OnInspectorGUI(); serializedObject.Update(); EditorGUILayout.Space(); EditorGUILayout.LabelField("Windows Gesture Settings", EditorStyles.boldLabel); + EditorGUILayout.Space(); EditorGUILayout.PropertyField(windowsGestureAutoStart); EditorGUILayout.PropertyField(manipulationGestures); EditorGUILayout.PropertyField(navigationGestures); diff --git a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Profiles/WindowsMixedRealityControllerDataProviderProfile.cs b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Profiles/WindowsMixedRealityControllerDataProviderProfile.cs index 2e6fe92..dc41679 100644 --- a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Profiles/WindowsMixedRealityControllerDataProviderProfile.cs +++ b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Profiles/WindowsMixedRealityControllerDataProviderProfile.cs @@ -6,7 +6,6 @@ using XRTK.Definitions.InputSystem; using XRTK.Definitions.Utilities; using XRTK.Definitions.Controllers; -using XRTK.Definitions.Controllers.OpenVR; using XRTK.WindowsMixedReality.Controllers; namespace XRTK.WindowsMixedReality.Profiles @@ -59,7 +58,7 @@ public override ControllerDefinition[] GetDefaultControllerOptions() { return new[] { - new ControllerDefinition(typeof(WindowsMixedRealityController)), + new ControllerDefinition("HoloLensController", typeof(WindowsMixedRealityController)), new ControllerDefinition(typeof(WindowsMixedRealityController), Handedness.Left), new ControllerDefinition(typeof(WindowsMixedRealityController), Handedness.Right), }; From f78cbf2a1509d92d54ec7034097afc020dfcd872 Mon Sep 17 00:00:00 2001 From: Stephen Hodgson Date: Wed, 8 Apr 2020 01:46:56 -0400 Subject: [PATCH 08/62] updated hand data provider profile inspector --- ...wsMixedRealityHandControllerDataProviderProfileInspector.cs | 3 --- 1 file changed, 3 deletions(-) diff --git a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Inspectors/WindowsMixedRealityHandControllerDataProviderProfileInspector.cs b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Inspectors/WindowsMixedRealityHandControllerDataProviderProfileInspector.cs index b99814d..2334e3e 100644 --- a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Inspectors/WindowsMixedRealityHandControllerDataProviderProfileInspector.cs +++ b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Inspectors/WindowsMixedRealityHandControllerDataProviderProfileInspector.cs @@ -14,9 +14,6 @@ public override void OnInspectorGUI() { RenderHeader(); - EditorGUILayout.Space(); - EditorGUILayout.LabelField("Windows Mixed Reality Hand Controller Data Provider Settings", EditorStyles.boldLabel); - base.OnInspectorGUI(); } } From 4b0f594f3457422c1fb066110be9d305c1fd8378 Mon Sep 17 00:00:00 2001 From: Stephen Hodgson Date: Wed, 8 Apr 2020 22:30:17 -0400 Subject: [PATCH 09/62] removed redundant inspector --- ...dControllerDataProviderProfileInspector.cs | 20 ------------------- ...rollerDataProviderProfileInspector.cs.meta | 11 ---------- 2 files changed, 31 deletions(-) delete mode 100644 XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Inspectors/WindowsMixedRealityHandControllerDataProviderProfileInspector.cs delete mode 100644 XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Inspectors/WindowsMixedRealityHandControllerDataProviderProfileInspector.cs.meta diff --git a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Inspectors/WindowsMixedRealityHandControllerDataProviderProfileInspector.cs b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Inspectors/WindowsMixedRealityHandControllerDataProviderProfileInspector.cs deleted file mode 100644 index 2334e3e..0000000 --- a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Inspectors/WindowsMixedRealityHandControllerDataProviderProfileInspector.cs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright (c) XRTK. All rights reserved. -// Licensed under the MIT License. See LICENSE in the project root for license information. - -using UnityEditor; -using XRTK.Inspectors.Profiles.InputSystem.Controllers; -using XRTK.WindowsMixedReality.Profiles; - -namespace XRTK.WindowsMixedReality.Inspectors -{ - [CustomEditor(typeof(WindowsMixedRealityHandControllerDataProviderProfile))] - public class WindowsMixedRealityHandControllerDataProviderProfileInspector : BaseMixedRealityHandControllerDataProviderProfileInspector - { - public override void OnInspectorGUI() - { - RenderHeader(); - - base.OnInspectorGUI(); - } - } -} \ No newline at end of file diff --git a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Inspectors/WindowsMixedRealityHandControllerDataProviderProfileInspector.cs.meta b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Inspectors/WindowsMixedRealityHandControllerDataProviderProfileInspector.cs.meta deleted file mode 100644 index c7b976e..0000000 --- a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Inspectors/WindowsMixedRealityHandControllerDataProviderProfileInspector.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: fd86308f7d99ef344bf0b3259392f28a -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {fileID: 2800000, guid: 6e2e9d716bbb4d8382bd53f11996b90e, type: 3} - userData: - assetBundleName: - assetBundleVariant: From 9f68cdb3260a671904618a56f969e445f2cd0aec Mon Sep 17 00:00:00 2001 From: Stephen Hodgson Date: Wed, 8 Apr 2020 22:56:48 -0400 Subject: [PATCH 10/62] cleaned up the controller interaction mappings a bit --- .../WindowsMixedRealityController.cs | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Controllers/WindowsMixedRealityController.cs b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Controllers/WindowsMixedRealityController.cs index b94d857..d75d4ea 100644 --- a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Controllers/WindowsMixedRealityController.cs +++ b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Controllers/WindowsMixedRealityController.cs @@ -34,18 +34,18 @@ public WindowsMixedRealityController(IMixedRealityControllerDataProvider control /// A single interaction mapping works for both left and right controllers. public override MixedRealityInteractionMapping[] DefaultInteractions => new[] { - new MixedRealityInteractionMapping("Spatial Pointer", AxisType.SixDof, DeviceInputType.SpatialPointer, MixedRealityInputAction.None), - new MixedRealityInteractionMapping("Spatial Grip", AxisType.SixDof, DeviceInputType.SpatialGrip, MixedRealityInputAction.None), - new MixedRealityInteractionMapping("Grip Press", AxisType.SingleAxis, DeviceInputType.TriggerPress, MixedRealityInputAction.None), - new MixedRealityInteractionMapping("Trigger Position", AxisType.SingleAxis, DeviceInputType.Trigger, MixedRealityInputAction.None), - new MixedRealityInteractionMapping("Trigger Touched", AxisType.Digital, DeviceInputType.TriggerTouch, MixedRealityInputAction.None), - new MixedRealityInteractionMapping("Trigger Press (Select)", AxisType.Digital, DeviceInputType.Select, MixedRealityInputAction.None), - new MixedRealityInteractionMapping("Touchpad Position", AxisType.DualAxis, DeviceInputType.Touchpad, MixedRealityInputAction.None), - new MixedRealityInteractionMapping("Touchpad Touch", AxisType.Digital, DeviceInputType.TouchpadTouch, MixedRealityInputAction.None), - new MixedRealityInteractionMapping("Touchpad Press", AxisType.Digital, DeviceInputType.TouchpadPress, MixedRealityInputAction.None), - new MixedRealityInteractionMapping("Menu Press", AxisType.Digital, DeviceInputType.Menu, MixedRealityInputAction.None), - new MixedRealityInteractionMapping("Thumbstick Position", AxisType.DualAxis, DeviceInputType.ThumbStick, MixedRealityInputAction.None), - new MixedRealityInteractionMapping("Thumbstick Press", AxisType.Digital, DeviceInputType.ThumbStickPress, MixedRealityInputAction.None), + new MixedRealityInteractionMapping("Spatial Pointer", AxisType.SixDof, DeviceInputType.SpatialPointer), + new MixedRealityInteractionMapping("Spatial Grip", AxisType.SixDof, DeviceInputType.SpatialGrip), + new MixedRealityInteractionMapping("Grip Press", AxisType.SingleAxis, DeviceInputType.TriggerPress), + new MixedRealityInteractionMapping("Trigger Position", AxisType.SingleAxis, DeviceInputType.Trigger), + new MixedRealityInteractionMapping("Trigger Touched", AxisType.Digital, DeviceInputType.TriggerTouch), + new MixedRealityInteractionMapping("Trigger Press (Select)", AxisType.Digital, DeviceInputType.Select), + new MixedRealityInteractionMapping("Touchpad Position", AxisType.DualAxis, DeviceInputType.Touchpad), + new MixedRealityInteractionMapping("Touchpad Touch", AxisType.Digital, DeviceInputType.TouchpadTouch), + new MixedRealityInteractionMapping("Touchpad Press", AxisType.Digital, DeviceInputType.TouchpadPress), + new MixedRealityInteractionMapping("Menu Press", AxisType.Digital, DeviceInputType.Menu), + new MixedRealityInteractionMapping("Thumbstick Position", AxisType.DualAxis, DeviceInputType.ThumbStick), + new MixedRealityInteractionMapping("Thumbstick Press", AxisType.Digital, DeviceInputType.ThumbStickPress), }; /// From 4fbd33fdf8d98b1c1353e711d1c894cbb7608dca Mon Sep 17 00:00:00 2001 From: Stephen Hodgson Date: Thu, 9 Apr 2020 03:03:19 -0400 Subject: [PATCH 11/62] updated references --- .../com.xrtk.wmr/Controllers/WindowsMixedRealityController.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Controllers/WindowsMixedRealityController.cs b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Controllers/WindowsMixedRealityController.cs index d75d4ea..42d8469 100644 --- a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Controllers/WindowsMixedRealityController.cs +++ b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Controllers/WindowsMixedRealityController.cs @@ -1,12 +1,11 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See LICENSE in the project root for license information. -using XRTK.Definitions.Controllers; using XRTK.Definitions.Devices; -using XRTK.Definitions.InputSystem; using XRTK.Definitions.Utilities; using XRTK.Interfaces.InputSystem; using XRTK.Interfaces.Providers.Controllers; +using XRTK.Providers.Controllers; #if UNITY_WSA using UnityEngine; From 7be68b582dd6a1d896c2dc5b6c064229fc9e4549 Mon Sep 17 00:00:00 2001 From: Stephen Hodgson Date: Thu, 9 Apr 2020 13:07:38 -0400 Subject: [PATCH 12/62] updated controller instance creation --- .../WindowsMixedRealityController.cs | 6 ++-- ...ndowsMixedRealityControllerDataProvider.cs | 29 +++++++++---------- ...sMixedRealityHandControllerDataProvider.cs | 22 +++++++------- 3 files changed, 27 insertions(+), 30 deletions(-) diff --git a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Controllers/WindowsMixedRealityController.cs b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Controllers/WindowsMixedRealityController.cs index 42d8469..449dfe4 100644 --- a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Controllers/WindowsMixedRealityController.cs +++ b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Controllers/WindowsMixedRealityController.cs @@ -1,9 +1,9 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See LICENSE in the project root for license information. +using XRTK.Definitions.Controllers; using XRTK.Definitions.Devices; using XRTK.Definitions.Utilities; -using XRTK.Interfaces.InputSystem; using XRTK.Interfaces.Providers.Controllers; using XRTK.Providers.Controllers; @@ -22,8 +22,8 @@ namespace XRTK.WindowsMixedReality.Controllers public class WindowsMixedRealityController : BaseController { /// - public WindowsMixedRealityController(IMixedRealityControllerDataProvider controllerDataProvider, TrackingState trackingState, Handedness controllerHandedness, IMixedRealityInputSource inputSource = null, MixedRealityInteractionMapping[] interactions = null) - : base(controllerDataProvider, trackingState, controllerHandedness, inputSource, interactions) + public WindowsMixedRealityController(IMixedRealityControllerDataProvider controllerDataProvider, TrackingState trackingState, Handedness controllerHandedness, MixedRealityControllerMappingProfile controllerMappingProfile) + : base(controllerDataProvider, trackingState, controllerHandedness, controllerMappingProfile) { } diff --git a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Controllers/WindowsMixedRealityControllerDataProvider.cs b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Controllers/WindowsMixedRealityControllerDataProvider.cs index 3789606..4f3bc08 100644 --- a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Controllers/WindowsMixedRealityControllerDataProvider.cs +++ b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Controllers/WindowsMixedRealityControllerDataProvider.cs @@ -5,6 +5,7 @@ using XRTK.WindowsMixedReality.Profiles; #if UNITY_WSA +using System; using System.Collections.Generic; using UnityEngine; using UnityEngine.XR.WSA.Input; @@ -403,39 +404,35 @@ private WindowsMixedRealityController GetController(InteractionSource interactio if (!addController) { return null; } - Handedness controllingHand; + Handedness handedness; + switch (interactionSource.handedness) { default: - controllingHand = Handedness.None; + handedness = Handedness.None; break; case InteractionSourceHandedness.Left: - controllingHand = Handedness.Left; + handedness = Handedness.Left; break; case InteractionSourceHandedness.Right: - controllingHand = Handedness.Right; + handedness = Handedness.Right; break; } - var pointers = interactionSource.supportsPointing ? RequestPointers(typeof(WindowsMixedRealityController), controllingHand) : null; - var nameModifier = controllingHand == Handedness.None ? interactionSource.kind.ToString() : controllingHand.ToString(); - var inputSource = MixedRealityToolkit.InputSystem?.RequestNewGenericInputSource($"Mixed Reality Controller {nameModifier}", pointers); - var detectedController = new WindowsMixedRealityController(this, TrackingState.NotApplicable, controllingHand, inputSource); + WindowsMixedRealityController detectedController; - if (!detectedController.SetupConfiguration(typeof(WindowsMixedRealityController))) + try + { + detectedController = new WindowsMixedRealityController(this, TrackingState.NotApplicable, handedness, GetControllerMappingProfile(typeof(WindowsMixedRealityController), handedness)); + } + catch (Exception e) { - // Controller failed to be setup correctly. - // Return null so we don't raise the source detected. + Debug.LogError($"Failed to create {nameof(WindowsMixedRealityController)}!\n{e}"); return null; } TryRenderControllerModel(interactionSource, detectedController); - for (int i = 0; i < detectedController.InputSource?.Pointers?.Length; i++) - { - detectedController.InputSource.Pointers[i].Controller = detectedController; - } - activeControllers.Add(interactionSource.id, detectedController); AddController(detectedController); return detectedController; diff --git a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Controllers/WindowsMixedRealityHandControllerDataProvider.cs b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Controllers/WindowsMixedRealityHandControllerDataProvider.cs index 2ff52b1..038e119 100644 --- a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Controllers/WindowsMixedRealityHandControllerDataProvider.cs +++ b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Controllers/WindowsMixedRealityHandControllerDataProvider.cs @@ -201,7 +201,7 @@ private bool TryGetController(Handedness handedness, out MixedRealityHandControl private MixedRealityHandController CreateController(SpatialInteractionSource spatialInteractionSource) { // We are creating a new controller for the source, determine the type of controller to use. - Type controllerType = spatialInteractionSource.Kind.ToControllerType(); + var controllerType = spatialInteractionSource.Kind.ToControllerType(); if (controllerType == null || controllerType != typeof(MixedRealityHandController)) { @@ -209,17 +209,17 @@ private MixedRealityHandController CreateController(SpatialInteractionSource spa return null; } - // Ready to create the controller instance. - var controllingHand = spatialInteractionSource.Handedness.ToHandedness(); - var pointers = spatialInteractionSource.IsPointingSupported ? RequestPointers(controllerType, controllingHand, true) : null; - var nameModifier = controllingHand == Handedness.None ? spatialInteractionSource.Kind.ToString() : controllingHand.ToString(); - var inputSource = MixedRealityToolkit.InputSystem?.RequestNewGenericInputSource($"Mixed Reality Hand Controller {nameModifier}", pointers); - var detectedController = new MixedRealityHandController(this, TrackingState.NotApplicable, controllingHand, inputSource); + var handedness = spatialInteractionSource.Handedness.ToHandedness(); - if (!detectedController.SetupConfiguration(controllerType)) + MixedRealityHandController detectedController; + + try + { + detectedController = new MixedRealityHandController(this, TrackingState.NotApplicable, handedness, GetControllerMappingProfile(typeof(MixedRealityHandController), handedness)); + } + catch (Exception e) { - // Controller failed to be setup correctly. - // Return null so we don't raise the source detected. + Debug.LogError($"Failed to create {nameof(MixedRealityHandController)}!\n{e}"); return null; } @@ -233,7 +233,7 @@ private MixedRealityHandController CreateController(SpatialInteractionSource spa detectedController.TryRenderControllerModel(controllerType); AddController(detectedController); - activeControllers.Add(controllingHand, detectedController); + activeControllers.Add(handedness, detectedController); return detectedController; } From f75eda4ed697384c5c2714f5bbb6fd42c8491cb7 Mon Sep 17 00:00:00 2001 From: Stephen Hodgson Date: Thu, 9 Apr 2020 18:35:03 -0400 Subject: [PATCH 13/62] added default constructor --- .../com.xrtk.wmr/Controllers/WindowsMixedRealityController.cs | 2 ++ .../Controllers/WindowsMixedRealityControllerDataProvider.cs | 1 - 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Controllers/WindowsMixedRealityController.cs b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Controllers/WindowsMixedRealityController.cs index 449dfe4..cccdc52 100644 --- a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Controllers/WindowsMixedRealityController.cs +++ b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Controllers/WindowsMixedRealityController.cs @@ -21,6 +21,8 @@ namespace XRTK.WindowsMixedReality.Controllers /// public class WindowsMixedRealityController : BaseController { + public WindowsMixedRealityController() : base() { } + /// public WindowsMixedRealityController(IMixedRealityControllerDataProvider controllerDataProvider, TrackingState trackingState, Handedness controllerHandedness, MixedRealityControllerMappingProfile controllerMappingProfile) : base(controllerDataProvider, trackingState, controllerHandedness, controllerMappingProfile) diff --git a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Controllers/WindowsMixedRealityControllerDataProvider.cs b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Controllers/WindowsMixedRealityControllerDataProvider.cs index 4f3bc08..d5eae92 100644 --- a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Controllers/WindowsMixedRealityControllerDataProvider.cs +++ b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Controllers/WindowsMixedRealityControllerDataProvider.cs @@ -19,7 +19,6 @@ #endif // UNITY_WSA #if WINDOWS_UWP -using System; using Windows.ApplicationModel.Core; using Windows.Perception; using Windows.Storage.Streams; From d5dc53b244562515a593d7d9d855499a557efc11 Mon Sep 17 00:00:00 2001 From: Stephen Hodgson Date: Thu, 9 Apr 2020 20:13:55 -0400 Subject: [PATCH 14/62] updated TryRenderController method --- .../Controllers/WindowsMixedRealityControllerDataProvider.cs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Controllers/WindowsMixedRealityControllerDataProvider.cs b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Controllers/WindowsMixedRealityControllerDataProvider.cs index d5eae92..a644ed1 100644 --- a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Controllers/WindowsMixedRealityControllerDataProvider.cs +++ b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Controllers/WindowsMixedRealityControllerDataProvider.cs @@ -481,11 +481,10 @@ async void DispatchedHandler() Debug.LogError("Failed to load model data!"); } - // This really isn't an error, we actually can call TryRenderControllerModelAsync here. - await controller.TryRenderControllerModelAsync(typeof(WindowsMixedRealityController), glbModelData, interactionSource.kind == InteractionSourceKind.Hand); + await controller.TryRenderControllerModelAsync(glbModelData, interactionSource.kind == InteractionSourceKind.Hand); } #else - await controller.TryRenderControllerModelAsync(typeof(WindowsMixedRealityController), null, interactionSource.kind == InteractionSourceKind.Hand); + await controller.TryRenderControllerModelAsync(null, interactionSource.kind == InteractionSourceKind.Hand); #endif // WINDOWS_UWP } From c21622311fb1edd0947e54c7dd123beee9b8f5f7 Mon Sep 17 00:00:00 2001 From: Stephen Hodgson Date: Sat, 11 Apr 2020 02:21:07 -0400 Subject: [PATCH 15/62] removed asset menu --- .../Profiles/WindowsMixedRealityControllerDataProviderProfile.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Profiles/WindowsMixedRealityControllerDataProviderProfile.cs b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Profiles/WindowsMixedRealityControllerDataProviderProfile.cs index dc41679..3cb7f8a 100644 --- a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Profiles/WindowsMixedRealityControllerDataProviderProfile.cs +++ b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Profiles/WindowsMixedRealityControllerDataProviderProfile.cs @@ -10,7 +10,6 @@ namespace XRTK.WindowsMixedReality.Profiles { - [CreateAssetMenu(menuName = "Mixed Reality Toolkit/Input System/Controller Data Providers/Windows Mixed Reality", fileName = "WindowsMixedRealityControllerDataProviderProfile", order = (int)CreateProfileMenuItemIndices.Input)] public class WindowsMixedRealityControllerDataProviderProfile : BaseMixedRealityControllerDataProviderProfile { [EnumFlags] From 78989661b7aa59dcdd6f21e71f8644dd3348a00d Mon Sep 17 00:00:00 2001 From: Stephen Hodgson Date: Sat, 11 Apr 2020 04:40:30 -0400 Subject: [PATCH 16/62] fixed compiler error --- .../WindowsMixedRealityHandControllerDataProvider.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Controllers/WindowsMixedRealityHandControllerDataProvider.cs b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Controllers/WindowsMixedRealityHandControllerDataProvider.cs index 038e119..9a8e045 100644 --- a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Controllers/WindowsMixedRealityHandControllerDataProvider.cs +++ b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Controllers/WindowsMixedRealityHandControllerDataProvider.cs @@ -230,7 +230,7 @@ private MixedRealityHandController CreateController(SpatialInteractionSource spa MixedRealityToolkit.InputSystem?.RaiseSourceDetected(detectedController.InputSource, detectedController); - detectedController.TryRenderControllerModel(controllerType); + detectedController.TryRenderControllerModel(); AddController(detectedController); activeControllers.Add(handedness, detectedController); From 32c8e4e27cabb54c3c1fd52ba9dad796b4a85d2a Mon Sep 17 00:00:00 2001 From: Dino Fejzagic Date: Sat, 11 Apr 2020 14:31:47 +0200 Subject: [PATCH 17/62] Remove obsolete SetupDefaultIntreactions (#65) --- .../Controllers/WindowsMixedRealityController.cs | 6 ------ 1 file changed, 6 deletions(-) diff --git a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Controllers/WindowsMixedRealityController.cs b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Controllers/WindowsMixedRealityController.cs index cccdc52..65f118a 100644 --- a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Controllers/WindowsMixedRealityController.cs +++ b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Controllers/WindowsMixedRealityController.cs @@ -55,12 +55,6 @@ public WindowsMixedRealityController(IMixedRealityControllerDataProvider control /// public override MixedRealityInteractionMapping[] DefaultRightHandedInteractions => DefaultInteractions; - /// - public override void SetupDefaultInteractions(Handedness controllerHandedness) - { - AssignControllerMappings(DefaultInteractions); - } - #if UNITY_WSA /// From 42c1ef4bd04a283b2517227fcc778ac4b777adc1 Mon Sep 17 00:00:00 2001 From: Stephen Hodgson Date: Sun, 12 Apr 2020 12:06:03 -0400 Subject: [PATCH 18/62] updated reference --- .../com.xrtk.wmr/Controllers/WindowsMixedRealityController.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Controllers/WindowsMixedRealityController.cs b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Controllers/WindowsMixedRealityController.cs index 39169dd..73c19ad 100644 --- a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Controllers/WindowsMixedRealityController.cs +++ b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Controllers/WindowsMixedRealityController.cs @@ -238,7 +238,7 @@ private void UpdateGripData(InteractionSourceState interactionSourceState, Mixed interactionSourceState.sourcePose.TryGetPosition(out currentGripPosition, InteractionSourceNode.Grip); interactionSourceState.sourcePose.TryGetRotation(out currentGripRotation, InteractionSourceNode.Grip); - var cameraRig = MixedRealityToolkit.CameraSystem?.CameraRig; + var cameraRig = MixedRealityToolkit.CameraSystem?.MainCameraRig; if (cameraRig != null && cameraRig.PlayspaceTransform != null) From 5266b4820daf437c8d30990d4bc12a22a2de732d Mon Sep 17 00:00:00 2001 From: Stephen Hodgson Date: Sun, 12 Apr 2020 14:21:06 -0400 Subject: [PATCH 19/62] added WMR Camera Data Provider --- .../WindowsMixedRealityCameraDataProvider.cs | 23 +++++++++++++++++++ ...dowsMixedRealityCameraDataProvider.cs.meta | 3 +++ 2 files changed, 26 insertions(+) create mode 100644 XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/WindowsMixedRealityCameraDataProvider.cs create mode 100644 XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/WindowsMixedRealityCameraDataProvider.cs.meta diff --git a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/WindowsMixedRealityCameraDataProvider.cs b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/WindowsMixedRealityCameraDataProvider.cs new file mode 100644 index 0000000..4d329c9 --- /dev/null +++ b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/WindowsMixedRealityCameraDataProvider.cs @@ -0,0 +1,23 @@ +using XRTK.Definitions.CameraSystem; + +#if WINDOWS_UWP +using Windows.Perception; +using Windows.UI.Input.Spatial; +#endif + +namespace XRTK.Providers.CameraSystem +{ + public class WindowsMixedRealityCameraDataProvider : BaseCameraDataProvider + { + public WindowsMixedRealityCameraDataProvider(string name, uint priority, BaseMixedRealityCameraDataProviderProfile profile) + : base(name, priority, profile) + { + } + + public override void Initialize() + { +#if WINDOWS_UWP +#endif + } + } +} \ No newline at end of file diff --git a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/WindowsMixedRealityCameraDataProvider.cs.meta b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/WindowsMixedRealityCameraDataProvider.cs.meta new file mode 100644 index 0000000..2b12808 --- /dev/null +++ b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/WindowsMixedRealityCameraDataProvider.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: cf1f82f1dd7043a39c45466e0ccf9c21 +timeCreated: 1586711429 \ No newline at end of file From 2222a71cae9bb7edf95049e4cb012a8d19961b2b Mon Sep 17 00:00:00 2001 From: Stephen Hodgson Date: Sun, 12 Apr 2020 16:03:06 -0400 Subject: [PATCH 20/62] updated WMR Camera Data Provider --- .../Packages/com.xrtk.wmr/Runtime.meta | 8 +++++ .../com.xrtk.wmr/Runtime/Providers.meta | 8 +++++ .../WindowsMixedRealityCameraDataProvider.cs | 30 +++++++++++++++++++ ...dowsMixedRealityCameraDataProvider.cs.meta | 0 .../WindowsMixedRealityCameraDataProvider.cs | 23 -------------- 5 files changed, 46 insertions(+), 23 deletions(-) create mode 100644 XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Runtime.meta create mode 100644 XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Runtime/Providers.meta create mode 100644 XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Runtime/Providers/WindowsMixedRealityCameraDataProvider.cs rename XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/{ => Runtime/Providers}/WindowsMixedRealityCameraDataProvider.cs.meta (100%) delete mode 100644 XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/WindowsMixedRealityCameraDataProvider.cs diff --git a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Runtime.meta b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Runtime.meta new file mode 100644 index 0000000..40ece7e --- /dev/null +++ b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Runtime.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: cf919f2df2ed4d24f9e989580f867e3f +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Runtime/Providers.meta b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Runtime/Providers.meta new file mode 100644 index 0000000..30ad1d0 --- /dev/null +++ b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Runtime/Providers.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 21a0cd75b0383154b9b16e5cfd03f8d6 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Runtime/Providers/WindowsMixedRealityCameraDataProvider.cs b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Runtime/Providers/WindowsMixedRealityCameraDataProvider.cs new file mode 100644 index 0000000..ff48663 --- /dev/null +++ b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Runtime/Providers/WindowsMixedRealityCameraDataProvider.cs @@ -0,0 +1,30 @@ +// Copyright (c) XRTK. All rights reserved. +// Licensed under the MIT License. See LICENSE in the project root for license information. + +using XRTK.Definitions.CameraSystem; +using XRTK.Providers.CameraSystem; + +namespace XRTK.WindowsMixedReality.Providers.CameraSystem +{ + public class WindowsMixedRealityCameraDataProvider : BaseCameraDataProvider + { + /// + public WindowsMixedRealityCameraDataProvider(string name, uint priority, BaseMixedRealityCameraDataProviderProfile profile) + : base(name, priority, profile) + { + } + + /// + public override bool IsOpaque + { + get + { +#if UNITY_WSA + return UnityEngine.XR.WSA.HolographicSettings.IsDisplayOpaque; +#else + return base.IsOpaque; +#endif + } + } + } +} \ No newline at end of file diff --git a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/WindowsMixedRealityCameraDataProvider.cs.meta b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Runtime/Providers/WindowsMixedRealityCameraDataProvider.cs.meta similarity index 100% rename from XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/WindowsMixedRealityCameraDataProvider.cs.meta rename to XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Runtime/Providers/WindowsMixedRealityCameraDataProvider.cs.meta diff --git a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/WindowsMixedRealityCameraDataProvider.cs b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/WindowsMixedRealityCameraDataProvider.cs deleted file mode 100644 index 4d329c9..0000000 --- a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/WindowsMixedRealityCameraDataProvider.cs +++ /dev/null @@ -1,23 +0,0 @@ -using XRTK.Definitions.CameraSystem; - -#if WINDOWS_UWP -using Windows.Perception; -using Windows.UI.Input.Spatial; -#endif - -namespace XRTK.Providers.CameraSystem -{ - public class WindowsMixedRealityCameraDataProvider : BaseCameraDataProvider - { - public WindowsMixedRealityCameraDataProvider(string name, uint priority, BaseMixedRealityCameraDataProviderProfile profile) - : base(name, priority, profile) - { - } - - public override void Initialize() - { -#if WINDOWS_UWP -#endif - } - } -} \ No newline at end of file From 846c22d7fcd36c6f6c45b966f5c32492868a4683 Mon Sep 17 00:00:00 2001 From: Stephen Hodgson Date: Sun, 12 Apr 2020 18:06:28 -0400 Subject: [PATCH 21/62] updated camera rig reference --- .../Utilities/WindowsMixedRealityHandDataConverter.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Utilities/WindowsMixedRealityHandDataConverter.cs b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Utilities/WindowsMixedRealityHandDataConverter.cs index 2b0817e..3750081 100644 --- a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Utilities/WindowsMixedRealityHandDataConverter.cs +++ b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Utilities/WindowsMixedRealityHandDataConverter.cs @@ -171,8 +171,8 @@ public HandData GetHandData(SpatialInteractionSourceState spatialInteractionSour // We want the controller to follow the Playspace, so fold in the playspace transform here to // put the controller pose into world space. - unityJointPositions[i] = MixedRealityToolkit.CameraSystem.CameraRig.PlayspaceTransform.TransformPoint(unityJointPositions[i]); - unityJointOrientations[i] = MixedRealityToolkit.CameraSystem.CameraRig.PlayspaceTransform.rotation * unityJointOrientations[i]; + unityJointPositions[i] = MixedRealityToolkit.CameraSystem.MainCameraRig.PlayspaceTransform.TransformPoint(unityJointPositions[i]); + unityJointOrientations[i] = MixedRealityToolkit.CameraSystem.MainCameraRig.PlayspaceTransform.rotation * unityJointOrientations[i]; TrackedHandJoint handJoint = jointIndices[i].ToTrackedHandJoint(); updatedHandData.Joints[(int)handJoint] = new MixedRealityPose(unityJointPositions[i], unityJointOrientations[i]); From 1ab38420272dc18fcc02a715f072f74f9371baca Mon Sep 17 00:00:00 2001 From: Stephen Hodgson Date: Mon, 13 Apr 2020 12:15:13 -0400 Subject: [PATCH 22/62] updated icon --- .../WindowsMixedRealityCameraDataProvider.cs.meta | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Runtime/Providers/WindowsMixedRealityCameraDataProvider.cs.meta b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Runtime/Providers/WindowsMixedRealityCameraDataProvider.cs.meta index 2b12808..abb6fd1 100644 --- a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Runtime/Providers/WindowsMixedRealityCameraDataProvider.cs.meta +++ b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Runtime/Providers/WindowsMixedRealityCameraDataProvider.cs.meta @@ -1,3 +1,11 @@ -fileFormatVersion: 2 +fileFormatVersion: 2 guid: cf1f82f1dd7043a39c45466e0ccf9c21 -timeCreated: 1586711429 \ No newline at end of file +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {fileID: 2800000, guid: 8ac5213854cf4dbabd140decf8df1946, type: 3} + userData: + assetBundleName: + assetBundleVariant: From 45ae978e0085cb4aa0959ebcff6ee8c8a4804a86 Mon Sep 17 00:00:00 2001 From: Stephen Hodgson Date: Mon, 13 Apr 2020 12:52:56 -0400 Subject: [PATCH 23/62] moved WMR Camera data provider into correct file location --- .../com.xrtk.wmr/Runtime/Providers/CameraSystem.meta | 8 ++++++++ .../WindowsMixedRealityCameraDataProvider.cs | 0 .../WindowsMixedRealityCameraDataProvider.cs.meta | 0 3 files changed, 8 insertions(+) create mode 100644 XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Runtime/Providers/CameraSystem.meta rename XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Runtime/Providers/{ => CameraSystem}/WindowsMixedRealityCameraDataProvider.cs (100%) rename XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Runtime/Providers/{ => CameraSystem}/WindowsMixedRealityCameraDataProvider.cs.meta (100%) diff --git a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Runtime/Providers/CameraSystem.meta b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Runtime/Providers/CameraSystem.meta new file mode 100644 index 0000000..4b70b26 --- /dev/null +++ b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Runtime/Providers/CameraSystem.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 57a6ad166fab8b44fb83e8c0378a30ef +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Runtime/Providers/WindowsMixedRealityCameraDataProvider.cs b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Runtime/Providers/CameraSystem/WindowsMixedRealityCameraDataProvider.cs similarity index 100% rename from XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Runtime/Providers/WindowsMixedRealityCameraDataProvider.cs rename to XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Runtime/Providers/CameraSystem/WindowsMixedRealityCameraDataProvider.cs diff --git a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Runtime/Providers/WindowsMixedRealityCameraDataProvider.cs.meta b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Runtime/Providers/CameraSystem/WindowsMixedRealityCameraDataProvider.cs.meta similarity index 100% rename from XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Runtime/Providers/WindowsMixedRealityCameraDataProvider.cs.meta rename to XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Runtime/Providers/CameraSystem/WindowsMixedRealityCameraDataProvider.cs.meta From f7e95a8ff99a8009d0c9bd8bfe97462fa68b4d55 Mon Sep 17 00:00:00 2001 From: Stephen Hodgson Date: Tue, 14 Apr 2020 00:09:39 -0400 Subject: [PATCH 24/62] updated data provider constructors --- .../WindowsMixedRealityControllerDataProvider.cs | 12 ++++-------- .../WindowsMixedRealityHandControllerDataProvider.cs | 12 ++++-------- .../WindowsMixedRealitySpatialMeshObserver.cs | 11 ++++------- 3 files changed, 12 insertions(+), 23 deletions(-) diff --git a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Controllers/WindowsMixedRealityControllerDataProvider.cs b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Controllers/WindowsMixedRealityControllerDataProvider.cs index 3789606..347b730 100644 --- a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Controllers/WindowsMixedRealityControllerDataProvider.cs +++ b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Controllers/WindowsMixedRealityControllerDataProvider.cs @@ -1,6 +1,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See LICENSE in the project root for license information. +using XRTK.Interfaces.InputSystem; using XRTK.Providers.Controllers; using XRTK.WindowsMixedReality.Profiles; @@ -33,14 +34,9 @@ namespace XRTK.WindowsMixedReality.Controllers /// public class WindowsMixedRealityControllerDataProvider : BaseControllerDataProvider { - /// - /// Constructor. - /// - /// - /// - /// - public WindowsMixedRealityControllerDataProvider(string name, uint priority, WindowsMixedRealityControllerDataProviderProfile profile) - : base(name, priority, profile) + /// + public WindowsMixedRealityControllerDataProvider(string name, uint priority, WindowsMixedRealityControllerDataProviderProfile profile, IMixedRealityInputSystem parentService) + : base(name, priority, profile, parentService) { #if UNITY_WSA this.profile = profile; diff --git a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Controllers/WindowsMixedRealityHandControllerDataProvider.cs b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Controllers/WindowsMixedRealityHandControllerDataProvider.cs index d3d8ca7..328481d 100644 --- a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Controllers/WindowsMixedRealityHandControllerDataProvider.cs +++ b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Controllers/WindowsMixedRealityHandControllerDataProvider.cs @@ -1,6 +1,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See LICENSE in the project root for license information. +using XRTK.Interfaces.InputSystem; using XRTK.Providers.Controllers.Hands; using XRTK.WindowsMixedReality.Profiles; @@ -29,14 +30,9 @@ namespace XRTK.WindowsMixedReality.Controllers /// public class WindowsMixedRealityHandControllerDataProvider : BaseHandControllerDataProvider { - /// - /// Constructor. - /// - /// Name of the data provider as assigned in the configuration profile. - /// Data provider priority controls the order in the service registry. - /// Controller data provider profile assigned to the provider instance in the configuration inspector. - public WindowsMixedRealityHandControllerDataProvider(string name, uint priority, WindowsMixedRealityHandControllerDataProviderProfile profile) - : base(name, priority, profile) + /// + public WindowsMixedRealityHandControllerDataProvider(string name, uint priority, WindowsMixedRealityHandControllerDataProviderProfile profile, IMixedRealityInputSystem parentService) + : base(name, priority, profile, parentService) { } diff --git a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/SpatialObservers/WindowsMixedRealitySpatialMeshObserver.cs b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/SpatialObservers/WindowsMixedRealitySpatialMeshObserver.cs index bd2504c..683ef93 100644 --- a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/SpatialObservers/WindowsMixedRealitySpatialMeshObserver.cs +++ b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/SpatialObservers/WindowsMixedRealitySpatialMeshObserver.cs @@ -1,6 +1,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See LICENSE in the project root for license information. +using XRTK.Interfaces.SpatialAwarenessSystem; using XRTK.Providers.SpatialObservers; using XRTK.WindowsMixedReality.Profiles; @@ -20,13 +21,9 @@ namespace XRTK.WindowsMixedReality.SpatialObservers /// public class WindowsMixedRealitySpatialMeshObserver : BaseMixedRealitySpatialMeshObserver { - /// - /// Constructor. - /// - /// - /// - /// - public WindowsMixedRealitySpatialMeshObserver(string name, uint priority, WindowsMixedRealitySpatialMeshObserverProfile profile) : base(name, priority, profile) + /// + public WindowsMixedRealitySpatialMeshObserver(string name, uint priority, WindowsMixedRealitySpatialMeshObserverProfile profile, IMixedRealitySpatialAwarenessSystem parentService) + : base(name, priority, profile, parentService) { #if UNITY_WSA #if UNITY_EDITOR From 2ec0286fdc12033e768d78e14d5e7285475742ed Mon Sep 17 00:00:00 2001 From: Stephen Hodgson Date: Tue, 14 Apr 2020 10:51:33 -0400 Subject: [PATCH 25/62] added service parent reference --- .../CameraSystem/WindowsMixedRealityCameraDataProvider.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Runtime/Providers/CameraSystem/WindowsMixedRealityCameraDataProvider.cs b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Runtime/Providers/CameraSystem/WindowsMixedRealityCameraDataProvider.cs index ff48663..d9a1409 100644 --- a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Runtime/Providers/CameraSystem/WindowsMixedRealityCameraDataProvider.cs +++ b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Runtime/Providers/CameraSystem/WindowsMixedRealityCameraDataProvider.cs @@ -2,6 +2,7 @@ // Licensed under the MIT License. See LICENSE in the project root for license information. using XRTK.Definitions.CameraSystem; +using XRTK.Interfaces.CameraSystem; using XRTK.Providers.CameraSystem; namespace XRTK.WindowsMixedReality.Providers.CameraSystem @@ -9,8 +10,8 @@ namespace XRTK.WindowsMixedReality.Providers.CameraSystem public class WindowsMixedRealityCameraDataProvider : BaseCameraDataProvider { /// - public WindowsMixedRealityCameraDataProvider(string name, uint priority, BaseMixedRealityCameraDataProviderProfile profile) - : base(name, priority, profile) + public WindowsMixedRealityCameraDataProvider(string name, uint priority, BaseMixedRealityCameraDataProviderProfile profile, IMixedRealityCameraSystem parentService) + : base(name, priority, profile, parentService) { } From ba216421c3f1032e12f9b800280b158087dfedeb Mon Sep 17 00:00:00 2001 From: Dino Fejzagic Date: Wed, 15 Apr 2020 14:37:47 +0200 Subject: [PATCH 26/62] Change requests for controller provider inspectors (#67) * Update indent levels for WMR settings * Cache GUIContent --- ...yControllerDataProviderProfileInspector.cs | 22 +++++++++++++------ 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Inspectors/WindowsMixedRealityControllerDataProviderProfileInspector.cs b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Inspectors/WindowsMixedRealityControllerDataProviderProfileInspector.cs index 44afc97..39f7d9f 100644 --- a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Inspectors/WindowsMixedRealityControllerDataProviderProfileInspector.cs +++ b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Inspectors/WindowsMixedRealityControllerDataProviderProfileInspector.cs @@ -2,6 +2,8 @@ // Licensed under the MIT License. See LICENSE in the project root for license information. using UnityEditor; +using UnityEngine; +using XRTK.Inspectors.Extensions; using XRTK.Inspectors.Profiles.InputSystem.Controllers; using XRTK.WindowsMixedReality.Profiles; @@ -16,6 +18,9 @@ public class WindowsMixedRealityControllerDataProviderProfileInspector : BaseMix private SerializedProperty railsNavigationGestures; private SerializedProperty windowsGestureAutoStart; + bool showGestureSettings = true; + private static readonly GUIContent gestureSettingsFoldoutHeader = new GUIContent("Windows Gesture Settings"); + protected override void OnEnable() { base.OnEnable(); @@ -33,13 +38,16 @@ public override void OnInspectorGUI() serializedObject.Update(); EditorGUILayout.Space(); - EditorGUILayout.LabelField("Windows Gesture Settings", EditorStyles.boldLabel); - EditorGUILayout.Space(); - EditorGUILayout.PropertyField(windowsGestureAutoStart); - EditorGUILayout.PropertyField(manipulationGestures); - EditorGUILayout.PropertyField(navigationGestures); - EditorGUILayout.PropertyField(useRailsNavigation); - EditorGUILayout.PropertyField(railsNavigationGestures); + showGestureSettings = EditorGUILayoutExtensions.FoldoutWithBoldLabel(showGestureSettings, gestureSettingsFoldoutHeader, true); + if (showGestureSettings) + { + EditorGUILayout.PropertyField(windowsGestureAutoStart); + EditorGUILayout.PropertyField(manipulationGestures); + EditorGUILayout.PropertyField(navigationGestures); + EditorGUILayout.PropertyField(useRailsNavigation); + EditorGUILayout.PropertyField(railsNavigationGestures); + } + serializedObject.ApplyModifiedProperties(); } } From 0bb662be5f2b6250b8bed06ba3c13b1328edcec8 Mon Sep 17 00:00:00 2001 From: Dino Fejzagic Date: Thu, 16 Apr 2020 13:35:25 +0200 Subject: [PATCH 27/62] Adjust WMR to recent core changes --- ...sMixedRealityHandControllerDataProvider.cs | 17 +++++---- .../WindowsMixedRealityHandDataConverter.cs | 35 ++++++++++++++----- ...ndowsMixedRealityHandDataConverter.cs.meta | 0 .../Extensions/HandJointKindExtensions.cs | 9 +++-- ...alInteractionSourceHandednessExtensions.cs | 8 +++-- .../SpatialInteractionSourceKindExtensions.cs | 8 +++-- .../Utilities/WindowsMixedRealityUtilities.cs | 9 +++-- 7 files changed, 62 insertions(+), 24 deletions(-) rename XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/{Utilities => Controllers}/WindowsMixedRealityHandDataConverter.cs (92%) rename XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/{Utilities => Controllers}/WindowsMixedRealityHandDataConverter.cs.meta (100%) diff --git a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Controllers/WindowsMixedRealityHandControllerDataProvider.cs b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Controllers/WindowsMixedRealityHandControllerDataProvider.cs index 5fdc8ce..5ebe780 100644 --- a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Controllers/WindowsMixedRealityHandControllerDataProvider.cs +++ b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Controllers/WindowsMixedRealityHandControllerDataProvider.cs @@ -4,6 +4,7 @@ using XRTK.Interfaces.InputSystem; using XRTK.Providers.Controllers.Hands; using XRTK.WindowsMixedReality.Profiles; +using XRTK.Definitions.Utilities; #if WINDOWS_UWP @@ -14,11 +15,9 @@ using Windows.Perception; using Windows.UI.Input.Spatial; using XRTK.Definitions.Devices; -using XRTK.Definitions.Utilities; using XRTK.Services; using XRTK.Utilities; using XRTK.WindowsMixedReality.Extensions; -using XRTK.WindowsMixedReality.Utilities; #endif // WINDOWS_UWP @@ -34,11 +33,15 @@ public class WindowsMixedRealityHandControllerDataProvider : BaseHandControllerD public WindowsMixedRealityHandControllerDataProvider(string name, uint priority, WindowsMixedRealityHandControllerDataProviderProfile profile, IMixedRealityInputSystem parentService) : base(name, priority, profile, parentService) { + leftHandConverter = new WindowsMixedRealityHandDataConverter(Handedness.Left, TrackedPoses); + rightHandConverter = new WindowsMixedRealityHandDataConverter(Handedness.Right, TrackedPoses); } + private readonly WindowsMixedRealityHandDataConverter leftHandConverter; + private readonly WindowsMixedRealityHandDataConverter rightHandConverter; + #if WINDOWS_UWP - private readonly WindowsMixedRealityHandDataConverter handDataConverter = new WindowsMixedRealityHandDataConverter(); private readonly Dictionary activeControllers = new Dictionary(); private SpatialInteractionManager spatialInteractionManager = null; @@ -99,12 +102,12 @@ public override void Update() if (TryGetController(spatialInteractionSource.Handedness.ToHandedness(), out MixedRealityHandController leftHandController)) { - leftHandController.UpdateController(handDataConverter.GetHandData(sourceState)); + leftHandController.UpdateController(leftHandConverter.GetHandData(sourceState)); } else { leftHandController = CreateController(spatialInteractionSource); - leftHandController.UpdateController(handDataConverter.GetHandData(sourceState)); + leftHandController.UpdateController(leftHandConverter.GetHandData(sourceState)); } } @@ -114,12 +117,12 @@ public override void Update() if (TryGetController(spatialInteractionSource.Handedness.ToHandedness(), out MixedRealityHandController rightHandController)) { - rightHandController.UpdateController(handDataConverter.GetHandData(sourceState)); + rightHandController.UpdateController(rightHandConverter.GetHandData(sourceState)); } else { rightHandController = CreateController(spatialInteractionSource); - rightHandController.UpdateController(handDataConverter.GetHandData(sourceState)); + rightHandController.UpdateController(rightHandConverter.GetHandData(sourceState)); } } } diff --git a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Utilities/WindowsMixedRealityHandDataConverter.cs b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Controllers/WindowsMixedRealityHandDataConverter.cs similarity index 92% rename from XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Utilities/WindowsMixedRealityHandDataConverter.cs rename to XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Controllers/WindowsMixedRealityHandDataConverter.cs index 3750081..98a2d23 100644 --- a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Utilities/WindowsMixedRealityHandDataConverter.cs +++ b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Controllers/WindowsMixedRealityHandDataConverter.cs @@ -1,26 +1,42 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) XRTK. All rights reserved. // Licensed under the MIT License. See LICENSE in the project root for license information. -#if WINDOWS_UWP - using System; using System.Collections.Generic; using UnityEngine; -using Windows.Perception.People; -using Windows.UI.Input.Spatial; using XRTK.Definitions.Controllers.Hands; +using XRTK.Definitions.Controllers.Simulation.Hands; using XRTK.Definitions.Utilities; using XRTK.Extensions; +using XRTK.Providers.Controllers.Hands; using XRTK.Services; using XRTK.WindowsMixedReality.Extensions; +using XRTK.WindowsMixedReality.Utilities; -namespace XRTK.WindowsMixedReality.Utilities +#if WINDOWS_UWP + +using Windows.Perception.People; +using Windows.UI.Input.Spatial; + +#endif // WINDOWS_UWP + +namespace XRTK.WindowsMixedReality.Controllers { /// /// Converts windows mixed reality hand data to . /// - public sealed class WindowsMixedRealityHandDataConverter + public sealed class WindowsMixedRealityHandDataConverter : BaseHandDataConverter { + /// + /// Constructor. + /// + /// Handedness of the hand this converter is created for. + /// The tracked poses collection to use for pose recognition. + public WindowsMixedRealityHandDataConverter(Handedness handedness, IReadOnlyList trackedPoses) : base(handedness, trackedPoses) + { } + +#if WINDOWS_UWP + /// /// Gets or sets whether hand mesh data should be read and converted. /// @@ -180,6 +196,7 @@ public HandData GetHandData(SpatialInteractionSourceState spatialInteractionSour } } + PostProcess(updatedHandData); return updatedHandData; } @@ -246,6 +263,6 @@ private bool HasRequestedHandMeshObserver(SpatialInteractionSourceHandedness han : handedness == SpatialInteractionSourceHandedness.Right && hasRequestedHandMeshObserverRightHand; } +#endif // WINDOWS_UWP } -} -#endif // WINDOWS_UWP \ No newline at end of file +} \ No newline at end of file diff --git a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Utilities/WindowsMixedRealityHandDataConverter.cs.meta b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Controllers/WindowsMixedRealityHandDataConverter.cs.meta similarity index 100% rename from XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Utilities/WindowsMixedRealityHandDataConverter.cs.meta rename to XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Controllers/WindowsMixedRealityHandDataConverter.cs.meta diff --git a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Extensions/HandJointKindExtensions.cs b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Extensions/HandJointKindExtensions.cs index 15e261f..74206a2 100644 --- a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Extensions/HandJointKindExtensions.cs +++ b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Extensions/HandJointKindExtensions.cs @@ -6,10 +6,14 @@ using Windows.Perception.People; using XRTK.Definitions.Controllers.Hands; +#endif // WINDOWS_UWP + namespace XRTK.WindowsMixedReality.Extensions { public static class HandJointKindExtensions { +#if WINDOWS_UWP + public static TrackedHandJoint ToTrackedHandJoint(this HandJointKind handJointKind) { switch (handJointKind) @@ -50,6 +54,7 @@ public static TrackedHandJoint ToTrackedHandJoint(this HandJointKind handJointKi default: return TrackedHandJoint.None; } } + +#endif // WINDOWS_UWP } -} -#endif // WINDOWS_UWP \ No newline at end of file +} \ No newline at end of file diff --git a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Extensions/SpatialInteractionSourceHandednessExtensions.cs b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Extensions/SpatialInteractionSourceHandednessExtensions.cs index c228204..e6d0608 100644 --- a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Extensions/SpatialInteractionSourceHandednessExtensions.cs +++ b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Extensions/SpatialInteractionSourceHandednessExtensions.cs @@ -6,10 +6,14 @@ using Windows.UI.Input.Spatial; using XRTK.Definitions.Utilities; +#endif // WINDOWS_UWP + namespace XRTK.WindowsMixedReality.Extensions { public static class SpatialInteractionSourceHandednessExtensions { +#if WINDOWS_UWP + /// /// Converts the native to a XRTK . /// @@ -28,6 +32,6 @@ public static Handedness ToHandedness(this SpatialInteractionSourceHandedness sp } } +#endif // WINDOWS_UWP } -} -#endif // WINDOWS_UWP \ No newline at end of file +} \ No newline at end of file diff --git a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Extensions/SpatialInteractionSourceKindExtensions.cs b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Extensions/SpatialInteractionSourceKindExtensions.cs index 08c1c4f..206aebd 100644 --- a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Extensions/SpatialInteractionSourceKindExtensions.cs +++ b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Extensions/SpatialInteractionSourceKindExtensions.cs @@ -8,10 +8,14 @@ using XRTK.Providers.Controllers.Hands; using XRTK.WindowsMixedReality.Controllers; +#endif // WINDOWS_UWP + namespace XRTK.WindowsMixedReality.Extensions { public static class SpatialInteractionSourceKindExtensions { +#if WINDOWS_UWP + /// /// Maps the native to a XRTK type. /// @@ -30,6 +34,6 @@ public static Type ToControllerType(this SpatialInteractionSourceKind spatialInt } } +#endif // WINDOWS_UWP } -} -#endif // WINDOWS_UWP \ No newline at end of file +} \ No newline at end of file diff --git a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Utilities/WindowsMixedRealityUtilities.cs b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Utilities/WindowsMixedRealityUtilities.cs index 0b6e8a5..2a02a1f 100644 --- a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Utilities/WindowsMixedRealityUtilities.cs +++ b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Utilities/WindowsMixedRealityUtilities.cs @@ -7,13 +7,18 @@ using UnityEngine.XR.WSA; using Windows.Perception.Spatial; +#endif // WINDOWS_UWP + namespace XRTK.WindowsMixedReality.Utilities { public static class WindowsMixedRealityUtilities { +#if WINDOWS_UWP + private static SpatialCoordinateSystem spatialCoordinateSystem = null; public static SpatialCoordinateSystem SpatialCoordinateSystem => spatialCoordinateSystem ?? (spatialCoordinateSystem = Marshal.GetObjectForIUnknown(WorldManager.GetNativeISpatialCoordinateSystemPtr()) as SpatialCoordinateSystem); + +#endif // WINDOWS_UWP } -} -#endif // WINDOWS_UWP \ No newline at end of file +} \ No newline at end of file From 35d5220c87568b255be417086c862c164643cf79 Mon Sep 17 00:00:00 2001 From: Dino Fejzagic Date: Thu, 16 Apr 2020 15:10:44 +0200 Subject: [PATCH 28/62] Update due to rename --- .../Controllers/WindowsMixedRealityHandDataConverter.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Controllers/WindowsMixedRealityHandDataConverter.cs b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Controllers/WindowsMixedRealityHandDataConverter.cs index 98a2d23..d76c155 100644 --- a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Controllers/WindowsMixedRealityHandDataConverter.cs +++ b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Controllers/WindowsMixedRealityHandDataConverter.cs @@ -32,7 +32,7 @@ public sealed class WindowsMixedRealityHandDataConverter : BaseHandDataConverter /// /// Handedness of the hand this converter is created for. /// The tracked poses collection to use for pose recognition. - public WindowsMixedRealityHandDataConverter(Handedness handedness, IReadOnlyList trackedPoses) : base(handedness, trackedPoses) + public WindowsMixedRealityHandDataConverter(Handedness handedness, IReadOnlyList trackedPoses) : base(handedness, trackedPoses) { } #if WINDOWS_UWP From 2da3841705c1cb3361291dce2bfcdbd220561de9 Mon Sep 17 00:00:00 2001 From: Dino Fejzagic Date: Thu, 16 Apr 2020 15:26:26 +0200 Subject: [PATCH 29/62] Cleanup usings --- .../WindowsMixedRealityHandDataConverter.cs | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Controllers/WindowsMixedRealityHandDataConverter.cs b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Controllers/WindowsMixedRealityHandDataConverter.cs index d76c155..ee6265c 100644 --- a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Controllers/WindowsMixedRealityHandDataConverter.cs +++ b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Controllers/WindowsMixedRealityHandDataConverter.cs @@ -1,22 +1,21 @@ // Copyright (c) XRTK. All rights reserved. // Licensed under the MIT License. See LICENSE in the project root for license information. -using System; using System.Collections.Generic; -using UnityEngine; using XRTK.Definitions.Controllers.Hands; -using XRTK.Definitions.Controllers.Simulation.Hands; using XRTK.Definitions.Utilities; -using XRTK.Extensions; using XRTK.Providers.Controllers.Hands; -using XRTK.Services; -using XRTK.WindowsMixedReality.Extensions; -using XRTK.WindowsMixedReality.Utilities; #if WINDOWS_UWP +using System; +using UnityEngine; using Windows.Perception.People; using Windows.UI.Input.Spatial; +using XRTK.Services; +using XRTK.WindowsMixedReality.Extensions; +using XRTK.WindowsMixedReality.Utilities; +using XRTK.Extensions; #endif // WINDOWS_UWP From fcbe40226b7f4b56a4abdf5f407445e782091656 Mon Sep 17 00:00:00 2001 From: Stephen Hodgson Date: Thu, 16 Apr 2020 17:58:07 -0400 Subject: [PATCH 30/62] Added rig reset override --- .../WindowsMixedRealityCameraDataProvider.cs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Runtime/Providers/CameraSystem/WindowsMixedRealityCameraDataProvider.cs b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Runtime/Providers/CameraSystem/WindowsMixedRealityCameraDataProvider.cs index d9a1409..148ebc6 100644 --- a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Runtime/Providers/CameraSystem/WindowsMixedRealityCameraDataProvider.cs +++ b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Runtime/Providers/CameraSystem/WindowsMixedRealityCameraDataProvider.cs @@ -1,6 +1,7 @@ // Copyright (c) XRTK. All rights reserved. // Licensed under the MIT License. See LICENSE in the project root for license information. +using UnityEngine; using XRTK.Definitions.CameraSystem; using XRTK.Interfaces.CameraSystem; using XRTK.Providers.CameraSystem; @@ -27,5 +28,18 @@ public override bool IsOpaque #endif } } + + /// + protected override void ResetRigTransforms() + { + CameraRig.PlayspaceTransform.position = Vector3.zero; + CameraRig.PlayspaceTransform.rotation = Quaternion.identity; + CameraRig.CameraTransform.position = IsStereoscopic || !IsOpaque + ? Vector3.zero + : new Vector3(0f, HeadHeight, 0f); + CameraRig.CameraTransform.rotation = Quaternion.identity; + CameraRig.BodyTransform.position = Vector3.zero; + CameraRig.BodyTransform.rotation = Quaternion.identity; + } } } \ No newline at end of file From 205d8f9cc190a6e16f5295d026c42e2b364dcf9a Mon Sep 17 00:00:00 2001 From: Stephen Hodgson Date: Sat, 18 Apr 2020 12:16:05 -0400 Subject: [PATCH 31/62] reverted changes --- .../WindowsMixedRealityCameraDataProvider.cs | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Runtime/Providers/CameraSystem/WindowsMixedRealityCameraDataProvider.cs b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Runtime/Providers/CameraSystem/WindowsMixedRealityCameraDataProvider.cs index 148ebc6..0bd1500 100644 --- a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Runtime/Providers/CameraSystem/WindowsMixedRealityCameraDataProvider.cs +++ b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Runtime/Providers/CameraSystem/WindowsMixedRealityCameraDataProvider.cs @@ -28,18 +28,5 @@ public override bool IsOpaque #endif } } - - /// - protected override void ResetRigTransforms() - { - CameraRig.PlayspaceTransform.position = Vector3.zero; - CameraRig.PlayspaceTransform.rotation = Quaternion.identity; - CameraRig.CameraTransform.position = IsStereoscopic || !IsOpaque - ? Vector3.zero - : new Vector3(0f, HeadHeight, 0f); - CameraRig.CameraTransform.rotation = Quaternion.identity; - CameraRig.BodyTransform.position = Vector3.zero; - CameraRig.BodyTransform.rotation = Quaternion.identity; - } } } \ No newline at end of file From 628386cbbd55b8862bbe7c4dde00451a85a208db Mon Sep 17 00:00:00 2001 From: Stephen Hodgson Date: Sat, 18 Apr 2020 20:44:28 -0400 Subject: [PATCH 32/62] removed unused reference --- .../CameraSystem/WindowsMixedRealityCameraDataProvider.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Runtime/Providers/CameraSystem/WindowsMixedRealityCameraDataProvider.cs b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Runtime/Providers/CameraSystem/WindowsMixedRealityCameraDataProvider.cs index 0bd1500..d9a1409 100644 --- a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Runtime/Providers/CameraSystem/WindowsMixedRealityCameraDataProvider.cs +++ b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Runtime/Providers/CameraSystem/WindowsMixedRealityCameraDataProvider.cs @@ -1,7 +1,6 @@ // Copyright (c) XRTK. All rights reserved. // Licensed under the MIT License. See LICENSE in the project root for license information. -using UnityEngine; using XRTK.Definitions.CameraSystem; using XRTK.Interfaces.CameraSystem; using XRTK.Providers.CameraSystem; From 0a4a3171db88e55c56240315e476ec2a1a7f19a5 Mon Sep 17 00:00:00 2001 From: Stephen Hodgson Date: Sat, 18 Apr 2020 21:43:53 -0400 Subject: [PATCH 33/62] added camera profile --- .../com.xrtk.wmr/DefaultProfiles.meta | 8 ++++++ ...owsMixedRealityCameraProviderProfile.asset | 28 +++++++++++++++++++ ...xedRealityCameraProviderProfile.asset.meta | 8 ++++++ 3 files changed, 44 insertions(+) create mode 100644 XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/DefaultProfiles.meta create mode 100644 XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/DefaultProfiles/WindowsMixedRealityCameraProviderProfile.asset create mode 100644 XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/DefaultProfiles/WindowsMixedRealityCameraProviderProfile.asset.meta diff --git a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/DefaultProfiles.meta b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/DefaultProfiles.meta new file mode 100644 index 0000000..51eb076 --- /dev/null +++ b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/DefaultProfiles.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 8f7c56386c42751418c8eac234ed8113 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/DefaultProfiles/WindowsMixedRealityCameraProviderProfile.asset b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/DefaultProfiles/WindowsMixedRealityCameraProviderProfile.asset new file mode 100644 index 0000000..de87051 --- /dev/null +++ b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/DefaultProfiles/WindowsMixedRealityCameraProviderProfile.asset @@ -0,0 +1,28 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &11400000 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 00d813fd5a164e19a160f322b2926006, type: 3} + m_Name: WindowsMixedRealityCameraProviderProfile + m_EditorClassIdentifier: + isCameraPersistent: 1 + nearClipPlaneOpaqueDisplay: 0.1 + cameraClearFlagsOpaqueDisplay: 1 + backgroundColorOpaqueDisplay: {r: 0, g: 0, b: 0, a: 1} + opaqueQualityLevel: 0 + nearClipPlaneTransparentDisplay: 0.85 + cameraClearFlagsTransparentDisplay: 2 + backgroundColorTransparentDisplay: {r: 0, g: 0, b: 0, a: 0} + transparentQualityLevel: 0 + cameraRigType: + reference: XRTK.Services.CameraSystem.DefaultCameraRig, XRTK + defaultHeadHeight: 0 + bodyAdjustmentAngle: 60 + bodyAdjustmentSpeed: 1 diff --git a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/DefaultProfiles/WindowsMixedRealityCameraProviderProfile.asset.meta b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/DefaultProfiles/WindowsMixedRealityCameraProviderProfile.asset.meta new file mode 100644 index 0000000..ba2725b --- /dev/null +++ b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/DefaultProfiles/WindowsMixedRealityCameraProviderProfile.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 57a7de86787ebb74ead8edbc180d4d14 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 11400000 + userData: + assetBundleName: + assetBundleVariant: From 4bbc8af2adfb7521a9967c22fa9f0d8db0de0f55 Mon Sep 17 00:00:00 2001 From: Stephen Hodgson Date: Sun, 19 Apr 2020 17:10:16 -0400 Subject: [PATCH 34/62] Updated windows controller type name to get the controller textures to show up correctly based on the type name --- ...Controller.cs => WindowsMixedRealityMotionController.cs} | 6 +++--- ....cs.meta => WindowsMixedRealityMotionController.cs.meta} | 0 .../WindowsMixedRealityControllerDataProviderProfile.cs | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) rename XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Controllers/{WindowsMixedRealityController.cs => WindowsMixedRealityMotionController.cs} (97%) rename XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Controllers/{WindowsMixedRealityController.cs.meta => WindowsMixedRealityMotionController.cs.meta} (100%) diff --git a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Controllers/WindowsMixedRealityController.cs b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Controllers/WindowsMixedRealityMotionController.cs similarity index 97% rename from XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Controllers/WindowsMixedRealityController.cs rename to XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Controllers/WindowsMixedRealityMotionController.cs index 4870321..ed6b7c5 100644 --- a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Controllers/WindowsMixedRealityController.cs +++ b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Controllers/WindowsMixedRealityMotionController.cs @@ -19,12 +19,12 @@ namespace XRTK.WindowsMixedReality.Controllers /// /// A Windows Mixed Reality Controller Instance. /// - public class WindowsMixedRealityController : BaseController + public class WindowsMixedRealityMotionController : BaseController { - public WindowsMixedRealityController() : base() { } + public WindowsMixedRealityMotionController() : base() { } /// - public WindowsMixedRealityController(IMixedRealityControllerDataProvider controllerDataProvider, TrackingState trackingState, Handedness controllerHandedness, MixedRealityControllerMappingProfile controllerMappingProfile) + public WindowsMixedRealityMotionController(IMixedRealityControllerDataProvider controllerDataProvider, TrackingState trackingState, Handedness controllerHandedness, MixedRealityControllerMappingProfile controllerMappingProfile) : base(controllerDataProvider, trackingState, controllerHandedness, controllerMappingProfile) { } diff --git a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Controllers/WindowsMixedRealityController.cs.meta b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Controllers/WindowsMixedRealityMotionController.cs.meta similarity index 100% rename from XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Controllers/WindowsMixedRealityController.cs.meta rename to XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Controllers/WindowsMixedRealityMotionController.cs.meta diff --git a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Profiles/WindowsMixedRealityControllerDataProviderProfile.cs b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Profiles/WindowsMixedRealityControllerDataProviderProfile.cs index 3cb7f8a..9c38b99 100644 --- a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Profiles/WindowsMixedRealityControllerDataProviderProfile.cs +++ b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Profiles/WindowsMixedRealityControllerDataProviderProfile.cs @@ -57,9 +57,9 @@ public override ControllerDefinition[] GetDefaultControllerOptions() { return new[] { - new ControllerDefinition("HoloLensController", typeof(WindowsMixedRealityController)), - new ControllerDefinition(typeof(WindowsMixedRealityController), Handedness.Left), - new ControllerDefinition(typeof(WindowsMixedRealityController), Handedness.Right), + new ControllerDefinition("HoloLensController", typeof(WindowsMixedRealityMotionController)), + new ControllerDefinition(typeof(WindowsMixedRealityMotionController), Handedness.Left), + new ControllerDefinition(typeof(WindowsMixedRealityMotionController), Handedness.Right), }; } } From 8ea54173846709337c8eae4d129c6ad0a235a874 Mon Sep 17 00:00:00 2001 From: Stephen Hodgson Date: Mon, 20 Apr 2020 14:45:22 -0400 Subject: [PATCH 35/62] fixed reference to renamed controller class --- .../WindowsMixedRealityControllerDataProvider.cs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Controllers/WindowsMixedRealityControllerDataProvider.cs b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Controllers/WindowsMixedRealityControllerDataProvider.cs index efe16a9..1ee9dee 100644 --- a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Controllers/WindowsMixedRealityControllerDataProvider.cs +++ b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Controllers/WindowsMixedRealityControllerDataProvider.cs @@ -387,12 +387,12 @@ protected override void OnDispose(bool finalizing) /// Source State provided by the SDK /// Should the Source be added as a controller if it isn't found? /// New or Existing Controller Input Source - private WindowsMixedRealityController GetController(InteractionSource interactionSource, bool addController = false) + private WindowsMixedRealityMotionController GetController(InteractionSource interactionSource, bool addController = false) { //If a device is already registered with the ID provided, just return it. if (activeControllers.ContainsKey(interactionSource.id)) { - var controller = activeControllers[interactionSource.id] as WindowsMixedRealityController; + var controller = activeControllers[interactionSource.id] as WindowsMixedRealityMotionController; Debug.Assert(controller != null); return controller; } @@ -414,15 +414,15 @@ private WindowsMixedRealityController GetController(InteractionSource interactio break; } - WindowsMixedRealityController detectedController; + WindowsMixedRealityMotionController detectedController; try { - detectedController = new WindowsMixedRealityController(this, TrackingState.NotApplicable, handedness, GetControllerMappingProfile(typeof(WindowsMixedRealityController), handedness)); + detectedController = new WindowsMixedRealityMotionController(this, TrackingState.NotApplicable, handedness, GetControllerMappingProfile(typeof(WindowsMixedRealityMotionController), handedness)); } catch (Exception e) { - Debug.LogError($"Failed to create {nameof(WindowsMixedRealityController)}!\n{e}"); + Debug.LogError($"Failed to create {nameof(WindowsMixedRealityMotionController)}!\n{e}"); return null; } @@ -433,7 +433,7 @@ private WindowsMixedRealityController GetController(InteractionSource interactio return detectedController; } - private static async void TryRenderControllerModel(InteractionSource interactionSource, WindowsMixedRealityController controller) + private static async void TryRenderControllerModel(InteractionSource interactionSource, WindowsMixedRealityMotionController controller) { #if WINDOWS_UWP if (!UnityEngine.XR.WSA.HolographicSettings.IsDisplayOpaque) { return; } From 6b5c79b3930979cdedbd234364150b4d32ae023a Mon Sep 17 00:00:00 2001 From: Stephen Hodgson Date: Mon, 20 Apr 2020 15:04:36 -0400 Subject: [PATCH 36/62] fixed more type references --- .../Controllers/WindowsMixedRealityMotionController.cs | 2 +- .../Extensions/SpatialInteractionSourceKindExtensions.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Controllers/WindowsMixedRealityMotionController.cs b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Controllers/WindowsMixedRealityMotionController.cs index ed6b7c5..33d7855 100644 --- a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Controllers/WindowsMixedRealityMotionController.cs +++ b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Controllers/WindowsMixedRealityMotionController.cs @@ -128,7 +128,7 @@ public void UpdateController(InteractionSourceState interactionSourceState) UpdateMenuData(interactionSourceState, interactionMapping); break; default: - Debug.LogError($"Input [{interactionMapping.InputType}] is not handled for this controller [{GetType().Name}]"); + Debug.LogError($"Input [{interactionMapping.Description}.{interactionMapping.InputType}] is not handled for this controller [{GetType().Name}]"); Enabled = false; break; } diff --git a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Extensions/SpatialInteractionSourceKindExtensions.cs b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Extensions/SpatialInteractionSourceKindExtensions.cs index 08c1c4f..a60d454 100644 --- a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Extensions/SpatialInteractionSourceKindExtensions.cs +++ b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Extensions/SpatialInteractionSourceKindExtensions.cs @@ -22,7 +22,7 @@ public static Type ToControllerType(this SpatialInteractionSourceKind spatialInt switch (spatialInteractionSourceKind) { case SpatialInteractionSourceKind.Controller: - return typeof(WindowsMixedRealityController); + return typeof(WindowsMixedRealityMotionController); case SpatialInteractionSourceKind.Hand: return typeof(MixedRealityHandController); default: From ac9676c83eecefd49e92598a621f4de0a022a57a Mon Sep 17 00:00:00 2001 From: Dino Fejzagic Date: Mon, 27 Apr 2020 14:20:39 +0200 Subject: [PATCH 37/62] Resolve merge issues --- .../Packages/com.xrtk.wmr/CHANGELOG.md | 12 - .../WindowsMixedRealityHandDataConverter.cs | 267 ++++++++++++++++++ ...ndowsMixedRealityHandDataConverter.cs.meta | 11 + 3 files changed, 278 insertions(+), 12 deletions(-) create mode 100644 XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Runtime/Utilities/WindowsMixedRealityHandDataConverter.cs create mode 100644 XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Runtime/Utilities/WindowsMixedRealityHandDataConverter.cs.meta diff --git a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/CHANGELOG.md b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/CHANGELOG.md index ccbac94..e69de29 100644 --- a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/CHANGELOG.md +++ b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/CHANGELOG.md @@ -1,12 +0,0 @@ -# Changelog - -All notable changes to this project will be documented in this file. - -The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), -and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). - -## [Unreleased] - -### Added - -- Hand tracking support for Microsoft HoloLens 2. \ No newline at end of file diff --git a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Runtime/Utilities/WindowsMixedRealityHandDataConverter.cs b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Runtime/Utilities/WindowsMixedRealityHandDataConverter.cs new file mode 100644 index 0000000..6575c74 --- /dev/null +++ b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Runtime/Utilities/WindowsMixedRealityHandDataConverter.cs @@ -0,0 +1,267 @@ +// Copyright (c) XRTK. All rights reserved. +// Licensed under the MIT License. See LICENSE in the project root for license information. + +using System.Collections.Generic; +using XRTK.Definitions.Controllers.Hands; +using XRTK.Definitions.Utilities; +using XRTK.Providers.Controllers.Hands; + +#if WINDOWS_UWP + +using System; +using UnityEngine; +using Windows.Perception.People; +using Windows.UI.Input.Spatial; +using XRTK.Services; +using XRTK.WindowsMixedReality.Extensions; +using XRTK.WindowsMixedReality.Utilities; +using XRTK.Extensions; + +#endif // WINDOWS_UWP + +namespace XRTK.WindowsMixedReality.Utilities +{ + /// + /// Converts windows mixed reality hand data to . + /// + public sealed class WindowsMixedRealityHandDataConverter : BaseHandDataConverter + { + /// + /// Constructor. + /// + /// Handedness of the hand this converter is created for. + /// The tracked poses collection to use for pose recognition. + public WindowsMixedRealityHandDataConverter(Handedness handedness, IReadOnlyList trackedPoses) : base(handedness, trackedPoses) + { } + +#if WINDOWS_UWP + + /// + /// Gets or sets whether hand mesh data should be read and converted. + /// + public static bool HandMeshingEnabled { get; set; } + + private readonly Vector3[] unityJointPositions = new Vector3[jointIndices.Length]; + private readonly Quaternion[] unityJointOrientations = new Quaternion[jointIndices.Length]; + private readonly Dictionary handMeshObservers = new Dictionary(); + + private int[] handMeshTriangleIndices = null; + private bool hasRequestedHandMeshObserverLeftHand = false; + private bool hasRequestedHandMeshObserverRightHand = false; + private Vector2[] handMeshUVs; + + private static readonly HandJointKind[] jointIndices = new HandJointKind[] + { + HandJointKind.Palm, + HandJointKind.Wrist, + HandJointKind.ThumbMetacarpal, + HandJointKind.ThumbProximal, + HandJointKind.ThumbDistal, + HandJointKind.ThumbTip, + HandJointKind.IndexMetacarpal, + HandJointKind.IndexProximal, + HandJointKind.IndexIntermediate, + HandJointKind.IndexDistal, + HandJointKind.IndexTip, + HandJointKind.MiddleMetacarpal, + HandJointKind.MiddleProximal, + HandJointKind.MiddleIntermediate, + HandJointKind.MiddleDistal, + HandJointKind.MiddleTip, + HandJointKind.RingMetacarpal, + HandJointKind.RingProximal, + HandJointKind.RingIntermediate, + HandJointKind.RingDistal, + HandJointKind.RingTip, + HandJointKind.LittleMetacarpal, + HandJointKind.LittleProximal, + HandJointKind.LittleIntermediate, + HandJointKind.LittleDistal, + HandJointKind.LittleTip + }; + + /// + /// Gets updated hand data for the current frame. + /// + /// Platform provided current input source state for the hand. + /// Platform agnostics hand data. + public HandData GetHandData(SpatialInteractionSourceState spatialInteractionSourceState) + { + HandPose handPose = spatialInteractionSourceState.TryGetHandPose(); + HandData updatedHandData = new HandData + { + IsTracked = handPose != null, + TimeStamp = DateTimeOffset.UtcNow.Ticks + }; + + if (updatedHandData.IsTracked) + { + // Accessing the hand mesh data involves copying quite a bit of data, so only do it if application requests it. + if (HandMeshingEnabled) + { + if (!handMeshObservers.ContainsKey(spatialInteractionSourceState.Source.Handedness) && !HasRequestedHandMeshObserver(spatialInteractionSourceState.Source.Handedness)) + { + SetHandMeshObserver(spatialInteractionSourceState); + } + + if (handMeshObservers.TryGetValue(spatialInteractionSourceState.Source.Handedness, out var handMeshObserver) && handMeshTriangleIndices == null) + { + uint indexCount = handMeshObserver.TriangleIndexCount; + ushort[] indices = new ushort[indexCount]; + handMeshObserver.GetTriangleIndices(indices); + handMeshTriangleIndices = new int[indexCount]; + Array.Copy(indices, handMeshTriangleIndices, (int)handMeshObserver.TriangleIndexCount); + + // Compute neutral pose + Vector3[] neutralPoseVertices = new Vector3[handMeshObserver.VertexCount]; + HandPose neutralPose = handMeshObserver.NeutralPose; + var vertexAndNormals = new HandMeshVertex[handMeshObserver.VertexCount]; + HandMeshVertexState handMeshVertexState = handMeshObserver.GetVertexStateForPose(neutralPose); + handMeshVertexState.GetVertices(vertexAndNormals); + + for (int i = 0; i < handMeshObserver.VertexCount; i++) + { + neutralPoseVertices[i] = vertexAndNormals[i].Position.ToUnity(); + } + + // Compute UV mapping + InitializeHandMeshUVs(neutralPoseVertices); + } + + if (handMeshObserver != null && handMeshTriangleIndices != null) + { + var vertexAndNormals = new HandMeshVertex[handMeshObserver.VertexCount]; + var handMeshVertexState = handMeshObserver.GetVertexStateForPose(handPose); + handMeshVertexState.GetVertices(vertexAndNormals); + + var meshTransform = handMeshVertexState.CoordinateSystem.TryGetTransformTo(WindowsMixedRealityUtilities.SpatialCoordinateSystem); + if (meshTransform.HasValue) + { + System.Numerics.Vector3 scale; + System.Numerics.Quaternion rotation; + System.Numerics.Vector3 translation; + System.Numerics.Matrix4x4.Decompose(meshTransform.Value, out scale, out rotation, out translation); + + var handMeshVertices = new Vector3[handMeshObserver.VertexCount]; + var handMeshNormals = new Vector3[handMeshObserver.VertexCount]; + + for (int i = 0; i < handMeshObserver.VertexCount; i++) + { + handMeshVertices[i] = vertexAndNormals[i].Position.ToUnity(); + handMeshNormals[i] = vertexAndNormals[i].Normal.ToUnity(); + } + + updatedHandData.Mesh = new HandMeshData( + handMeshVertices, + handMeshTriangleIndices, + handMeshNormals, + handMeshUVs, + translation.ToUnity(), + rotation.ToUnity()); + } + } + } + else if (handMeshObservers.ContainsKey(spatialInteractionSourceState.Source.Handedness)) + { + // if hand mesh visualization is disabled make sure to destroy our hand mesh observer if it has already been created + if (spatialInteractionSourceState.Source.Handedness == SpatialInteractionSourceHandedness.Left) + { + hasRequestedHandMeshObserverLeftHand = false; + } + else if (spatialInteractionSourceState.Source.Handedness == SpatialInteractionSourceHandedness.Right) + { + hasRequestedHandMeshObserverRightHand = false; + } + + handMeshObservers.Remove(spatialInteractionSourceState.Source.Handedness); + } + + JointPose[] jointPoses = new JointPose[jointIndices.Length]; + if (handPose.TryGetJoints(WindowsMixedRealityUtilities.SpatialCoordinateSystem, jointIndices, jointPoses)) + { + for (int i = 0; i < jointPoses.Length; i++) + { + unityJointOrientations[i] = jointPoses[i].Orientation.ToUnity(); + unityJointPositions[i] = jointPoses[i].Position.ToUnity(); + + // We want the controller to follow the Playspace, so fold in the playspace transform here to + // put the controller pose into world space. + unityJointPositions[i] = MixedRealityToolkit.CameraSystem.MainCameraRig.PlayspaceTransform.TransformPoint(unityJointPositions[i]); + unityJointOrientations[i] = MixedRealityToolkit.CameraSystem.MainCameraRig.PlayspaceTransform.rotation * unityJointOrientations[i]; + + TrackedHandJoint handJoint = jointIndices[i].ToTrackedHandJoint(); + updatedHandData.Joints[(int)handJoint] = new MixedRealityPose(unityJointPositions[i], unityJointOrientations[i]); + } + } + } + + PostProcess(updatedHandData); + return updatedHandData; + } + + private void InitializeHandMeshUVs(Vector3[] neutralPoseVertices) + { + if (neutralPoseVertices.Length == 0) + { + Debug.LogError("Loaded 0 verts for neutralPoseVertices"); + } + + float minY = neutralPoseVertices[0].y; + float maxY = minY; + + float maxMagnitude = 0.0f; + + for (int ix = 1; ix < neutralPoseVertices.Length; ix++) + { + Vector3 p = neutralPoseVertices[ix]; + + if (p.y < minY) + { + minY = p.y; + } + else if (p.y > maxY) + { + maxY = p.y; + } + float d = p.x * p.x + p.y * p.y; + if (d > maxMagnitude) maxMagnitude = d; + } + + maxMagnitude = Mathf.Sqrt(maxMagnitude); + float scale = 1.0f / (maxY - minY); + + handMeshUVs = new Vector2[neutralPoseVertices.Length]; + + for (int ix = 0; ix < neutralPoseVertices.Length; ix++) + { + Vector3 p = neutralPoseVertices[ix]; + + handMeshUVs[ix] = new Vector2(p.x * scale + 0.5f, (p.y - minY) * scale); + } + } + + private async void SetHandMeshObserver(SpatialInteractionSourceState sourceState) + { + if (handMeshObservers.ContainsKey(sourceState.Source.Handedness)) + { + handMeshObservers[sourceState.Source.Handedness] = await sourceState.Source.TryCreateHandMeshObserverAsync(); + } + else + { + handMeshObservers.Add(sourceState.Source.Handedness, await sourceState.Source.TryCreateHandMeshObserverAsync()); + } + + hasRequestedHandMeshObserverLeftHand = sourceState.Source.Handedness == SpatialInteractionSourceHandedness.Left; + hasRequestedHandMeshObserverRightHand = sourceState.Source.Handedness == SpatialInteractionSourceHandedness.Right; + } + + private bool HasRequestedHandMeshObserver(SpatialInteractionSourceHandedness handedness) + { + return handedness == SpatialInteractionSourceHandedness.Left + ? hasRequestedHandMeshObserverLeftHand + : handedness == SpatialInteractionSourceHandedness.Right && hasRequestedHandMeshObserverRightHand; + } + +#endif // WINDOWS_UWP + } +} \ No newline at end of file diff --git a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Runtime/Utilities/WindowsMixedRealityHandDataConverter.cs.meta b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Runtime/Utilities/WindowsMixedRealityHandDataConverter.cs.meta new file mode 100644 index 0000000..5ffb85d --- /dev/null +++ b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Runtime/Utilities/WindowsMixedRealityHandDataConverter.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 25d284a3f798cfa4bbe5a4c86eb9527b +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {fileID: 2800000, guid: 8ac5213854cf4dbabd140decf8df1946, type: 3} + userData: + assetBundleName: + assetBundleVariant: \ No newline at end of file From de697a65e4f28320cab62ab7255ca8cb4e01cbf7 Mon Sep 17 00:00:00 2001 From: Dino Fejzagic Date: Mon, 27 Apr 2020 14:24:16 +0200 Subject: [PATCH 38/62] Reset some unrelated file changes --- .../Runtime/Extensions/HandJointKindExtensions.cs | 9 ++------- .../SpatialInteractionSourceHandednessExtensions.cs | 8 ++------ .../Extensions/SpatialInteractionSourceKindExtensions.cs | 8 ++------ .../Runtime/Utilities/WindowsMixedRealityUtilities.cs | 9 ++------- 4 files changed, 8 insertions(+), 26 deletions(-) diff --git a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Runtime/Extensions/HandJointKindExtensions.cs b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Runtime/Extensions/HandJointKindExtensions.cs index 74206a2..15e261f 100644 --- a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Runtime/Extensions/HandJointKindExtensions.cs +++ b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Runtime/Extensions/HandJointKindExtensions.cs @@ -6,14 +6,10 @@ using Windows.Perception.People; using XRTK.Definitions.Controllers.Hands; -#endif // WINDOWS_UWP - namespace XRTK.WindowsMixedReality.Extensions { public static class HandJointKindExtensions { -#if WINDOWS_UWP - public static TrackedHandJoint ToTrackedHandJoint(this HandJointKind handJointKind) { switch (handJointKind) @@ -54,7 +50,6 @@ public static TrackedHandJoint ToTrackedHandJoint(this HandJointKind handJointKi default: return TrackedHandJoint.None; } } - -#endif // WINDOWS_UWP } -} \ No newline at end of file +} +#endif // WINDOWS_UWP \ No newline at end of file diff --git a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Runtime/Extensions/SpatialInteractionSourceHandednessExtensions.cs b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Runtime/Extensions/SpatialInteractionSourceHandednessExtensions.cs index e6d0608..c228204 100644 --- a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Runtime/Extensions/SpatialInteractionSourceHandednessExtensions.cs +++ b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Runtime/Extensions/SpatialInteractionSourceHandednessExtensions.cs @@ -6,14 +6,10 @@ using Windows.UI.Input.Spatial; using XRTK.Definitions.Utilities; -#endif // WINDOWS_UWP - namespace XRTK.WindowsMixedReality.Extensions { public static class SpatialInteractionSourceHandednessExtensions { -#if WINDOWS_UWP - /// /// Converts the native to a XRTK . /// @@ -32,6 +28,6 @@ public static Handedness ToHandedness(this SpatialInteractionSourceHandedness sp } } -#endif // WINDOWS_UWP } -} \ No newline at end of file +} +#endif // WINDOWS_UWP \ No newline at end of file diff --git a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Runtime/Extensions/SpatialInteractionSourceKindExtensions.cs b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Runtime/Extensions/SpatialInteractionSourceKindExtensions.cs index 9ead016..a60d454 100644 --- a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Runtime/Extensions/SpatialInteractionSourceKindExtensions.cs +++ b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Runtime/Extensions/SpatialInteractionSourceKindExtensions.cs @@ -8,14 +8,10 @@ using XRTK.Providers.Controllers.Hands; using XRTK.WindowsMixedReality.Controllers; -#endif // WINDOWS_UWP - namespace XRTK.WindowsMixedReality.Extensions { public static class SpatialInteractionSourceKindExtensions { -#if WINDOWS_UWP - /// /// Maps the native to a XRTK type. /// @@ -34,6 +30,6 @@ public static Type ToControllerType(this SpatialInteractionSourceKind spatialInt } } -#endif // WINDOWS_UWP } -} \ No newline at end of file +} +#endif // WINDOWS_UWP \ No newline at end of file diff --git a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Runtime/Utilities/WindowsMixedRealityUtilities.cs b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Runtime/Utilities/WindowsMixedRealityUtilities.cs index 2a02a1f..0b6e8a5 100644 --- a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Runtime/Utilities/WindowsMixedRealityUtilities.cs +++ b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Runtime/Utilities/WindowsMixedRealityUtilities.cs @@ -7,18 +7,13 @@ using UnityEngine.XR.WSA; using Windows.Perception.Spatial; -#endif // WINDOWS_UWP - namespace XRTK.WindowsMixedReality.Utilities { public static class WindowsMixedRealityUtilities { -#if WINDOWS_UWP - private static SpatialCoordinateSystem spatialCoordinateSystem = null; public static SpatialCoordinateSystem SpatialCoordinateSystem => spatialCoordinateSystem ?? (spatialCoordinateSystem = Marshal.GetObjectForIUnknown(WorldManager.GetNativeISpatialCoordinateSystemPtr()) as SpatialCoordinateSystem); - -#endif // WINDOWS_UWP } -} \ No newline at end of file +} +#endif // WINDOWS_UWP \ No newline at end of file From 1331ae7b04bb0bc11bc5df38a7daf5258b0436d7 Mon Sep 17 00:00:00 2001 From: Dino Fejzagic Date: Mon, 27 Apr 2020 14:26:50 +0200 Subject: [PATCH 39/62] Fix namespace --- .../WindowsMixedRealityHandControllerDataProvider.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Runtime/Providers/InputSystem/Controllers/WindowsMixedRealityHandControllerDataProvider.cs b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Runtime/Providers/InputSystem/Controllers/WindowsMixedRealityHandControllerDataProvider.cs index 5ebe780..194c3ef 100644 --- a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Runtime/Providers/InputSystem/Controllers/WindowsMixedRealityHandControllerDataProvider.cs +++ b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Runtime/Providers/InputSystem/Controllers/WindowsMixedRealityHandControllerDataProvider.cs @@ -5,6 +5,7 @@ using XRTK.Providers.Controllers.Hands; using XRTK.WindowsMixedReality.Profiles; using XRTK.Definitions.Utilities; +using XRTK.WindowsMixedReality.Utilities; #if WINDOWS_UWP @@ -21,7 +22,7 @@ #endif // WINDOWS_UWP -namespace XRTK.WindowsMixedReality.Controllers +namespace XRTK.WindowsMixedReality.Providers.InputSystem.Controllers { /// /// The Windows Mixed Reality Data Provider for hand controller support. From 385bef39b6243766b3d876f1288ee4121fdd8536 Mon Sep 17 00:00:00 2001 From: Dino Fejzagic Date: Sat, 2 May 2020 17:11:00 +0200 Subject: [PATCH 40/62] Moved WMR hand data provider profile asset --- ...ityHandControllerDataProviderProfile.asset | 23 +++++++++++++++++++ ...ndControllerDataProviderProfile.asset.meta | 8 +++++++ 2 files changed, 31 insertions(+) create mode 100644 XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Profiles~/Contollers/WindowsMixedRealityHandControllerDataProviderProfile.asset create mode 100644 XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Profiles~/Contollers/WindowsMixedRealityHandControllerDataProviderProfile.asset.meta diff --git a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Profiles~/Contollers/WindowsMixedRealityHandControllerDataProviderProfile.asset b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Profiles~/Contollers/WindowsMixedRealityHandControllerDataProviderProfile.asset new file mode 100644 index 0000000..877e855 --- /dev/null +++ b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Profiles~/Contollers/WindowsMixedRealityHandControllerDataProviderProfile.asset @@ -0,0 +1,23 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &11400000 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 29a54eda3f140e7418c5cb5c2bccd329, type: 3} + m_Name: WindowsMixedRealityHandControllerDataProviderProfile + m_EditorClassIdentifier: + hasSetupDefaults: 1 + controllerMappingProfiles: + - {fileID: 11400000, guid: e2ae1ca0318feab47a20524104ba0a94, type: 2} + - {fileID: 11400000, guid: fa146e915b7a500418bef3446a876138, type: 2} + handMeshingEnabled: 0 + handPhysicsEnabled: 0 + useTriggers: 0 + boundsMode: 0 + trackedPoses: [] diff --git a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Profiles~/Contollers/WindowsMixedRealityHandControllerDataProviderProfile.asset.meta b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Profiles~/Contollers/WindowsMixedRealityHandControllerDataProviderProfile.asset.meta new file mode 100644 index 0000000..7c46063 --- /dev/null +++ b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Profiles~/Contollers/WindowsMixedRealityHandControllerDataProviderProfile.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 11ef7a331fa0a164bb9ac3e5cae510ff +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 11400000 + userData: + assetBundleName: + assetBundleVariant: From 79a005cb0df115f2a2a89a6ae5e2547fc94eccc9 Mon Sep 17 00:00:00 2001 From: Dino Fejzagic Date: Sat, 2 May 2020 17:15:10 +0200 Subject: [PATCH 41/62] Fix WMR namespace compiler error --- .../Extensions/SpatialInteractionSourceKindExtensions.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Runtime/Extensions/SpatialInteractionSourceKindExtensions.cs b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Runtime/Extensions/SpatialInteractionSourceKindExtensions.cs index a60d454..af27fdb 100644 --- a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Runtime/Extensions/SpatialInteractionSourceKindExtensions.cs +++ b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Runtime/Extensions/SpatialInteractionSourceKindExtensions.cs @@ -6,7 +6,7 @@ using System; using Windows.UI.Input.Spatial; using XRTK.Providers.Controllers.Hands; -using XRTK.WindowsMixedReality.Controllers; +using XRTK.WindowsMixedReality.Providers.InputSystem.Controllers; namespace XRTK.WindowsMixedReality.Extensions { From 7e82446464b4212ec4c5c9240a2b49eedd5aff73 Mon Sep 17 00:00:00 2001 From: Dino Fejzagic Date: Sun, 3 May 2020 11:17:39 +0200 Subject: [PATCH 42/62] Cleanup namespace --- .../Runtime/Utilities/WindowsMixedRealityHandDataConverter.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Runtime/Utilities/WindowsMixedRealityHandDataConverter.cs b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Runtime/Utilities/WindowsMixedRealityHandDataConverter.cs index 6575c74..5413447 100644 --- a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Runtime/Utilities/WindowsMixedRealityHandDataConverter.cs +++ b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Runtime/Utilities/WindowsMixedRealityHandDataConverter.cs @@ -14,7 +14,6 @@ using Windows.UI.Input.Spatial; using XRTK.Services; using XRTK.WindowsMixedReality.Extensions; -using XRTK.WindowsMixedReality.Utilities; using XRTK.Extensions; #endif // WINDOWS_UWP From a99946a92cb589eac5b87183f1954534a300c187 Mon Sep 17 00:00:00 2001 From: Dino Fejzagic Date: Sun, 3 May 2020 13:10:40 +0200 Subject: [PATCH 43/62] Move default wmr data provider profile from SDK --- ...RealityControllerDataProviderProfile.asset | 24 +++++++++++++++++++ ...tyControllerDataProviderProfile.asset.meta | 8 +++++++ 2 files changed, 32 insertions(+) create mode 100644 XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Profiles~/Contollers/WindowsMixedRealityControllerDataProviderProfile.asset create mode 100644 XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Profiles~/Contollers/WindowsMixedRealityControllerDataProviderProfile.asset.meta diff --git a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Profiles~/Contollers/WindowsMixedRealityControllerDataProviderProfile.asset b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Profiles~/Contollers/WindowsMixedRealityControllerDataProviderProfile.asset new file mode 100644 index 0000000..d2e4007 --- /dev/null +++ b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Profiles~/Contollers/WindowsMixedRealityControllerDataProviderProfile.asset @@ -0,0 +1,24 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &11400000 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe9eeb08f95b1c1419ad17953d9a48ee, type: 3} + m_Name: WindowsMixedRealityControllerDataProviderProfile + m_EditorClassIdentifier: + hasSetupDefaults: 1 + controllerMappingProfiles: + - {fileID: 11400000, guid: aaa9b82b55ce7834bb43c9d726ff893e, type: 2} + - {fileID: 11400000, guid: 752ece58d1e10d4458ac9d6ad664cc58, type: 2} + - {fileID: 11400000, guid: 87a124892ea548a4ea4cbba488e06b5a, type: 2} + manipulationGestures: 0 + navigationGestures: 0 + useRailsNavigation: 0 + railsNavigationGestures: 0 + windowsGestureAutoStart: 0 diff --git a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Profiles~/Contollers/WindowsMixedRealityControllerDataProviderProfile.asset.meta b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Profiles~/Contollers/WindowsMixedRealityControllerDataProviderProfile.asset.meta new file mode 100644 index 0000000..186230d --- /dev/null +++ b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Profiles~/Contollers/WindowsMixedRealityControllerDataProviderProfile.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 8e0139954c0b0ab41a6f5fce7c0594e1 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 11400000 + userData: + assetBundleName: + assetBundleVariant: From fb39291e7417e7abd14a52ca6385b07ee91a0c47 Mon Sep 17 00:00:00 2001 From: Dino Fejzagic Date: Sun, 3 May 2020 17:23:10 +0200 Subject: [PATCH 44/62] Update profile references --- ...WindowsMixedRealityHandControllerDataProviderProfile.asset | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Profiles~/Contollers/WindowsMixedRealityHandControllerDataProviderProfile.asset b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Profiles~/Contollers/WindowsMixedRealityHandControllerDataProviderProfile.asset index 877e855..4152880 100644 --- a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Profiles~/Contollers/WindowsMixedRealityHandControllerDataProviderProfile.asset +++ b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Profiles~/Contollers/WindowsMixedRealityHandControllerDataProviderProfile.asset @@ -14,8 +14,8 @@ MonoBehaviour: m_EditorClassIdentifier: hasSetupDefaults: 1 controllerMappingProfiles: - - {fileID: 11400000, guid: e2ae1ca0318feab47a20524104ba0a94, type: 2} - - {fileID: 11400000, guid: fa146e915b7a500418bef3446a876138, type: 2} + - {fileID: 11400000, guid: 777fb11f650654740825e1853e030405, type: 2} + - {fileID: 11400000, guid: 094680cae747ccb438c376af7ec85f32, type: 2} handMeshingEnabled: 0 handPhysicsEnabled: 0 useTriggers: 0 From 6697acf5f0703fc9cc244763ddef1f68eba4374d Mon Sep 17 00:00:00 2001 From: Dino Fejzagic Date: Sun, 10 May 2020 09:51:32 +0200 Subject: [PATCH 45/62] Introduce hand rendering mode --- .../WindowsMixedRealityHandControllerDataProvider.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Runtime/Providers/InputSystem/Controllers/WindowsMixedRealityHandControllerDataProvider.cs b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Runtime/Providers/InputSystem/Controllers/WindowsMixedRealityHandControllerDataProvider.cs index 5d7aed2..c756f43 100644 --- a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Runtime/Providers/InputSystem/Controllers/WindowsMixedRealityHandControllerDataProvider.cs +++ b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Runtime/Providers/InputSystem/Controllers/WindowsMixedRealityHandControllerDataProvider.cs @@ -21,6 +21,7 @@ using XRTK.Services; using XRTK.Utilities; using XRTK.WindowsMixedReality.Extensions; +using XRTK.Definitions.Controllers.Hands; #endif // WINDOWS_UWP @@ -77,7 +78,7 @@ private SpatialInteractionManager SpatialInteractionManager public override void Initialize() { base.Initialize(); - WindowsMixedRealityHandDataConverter.HandMeshingEnabled = HandMeshingEnabled; + WindowsMixedRealityHandDataConverter.HandMeshingEnabled = RenderingMode == HandRenderingMode.Mesh; } /// From f6443d7cf8a0d639a155ff3498428500fa0c4dff Mon Sep 17 00:00:00 2001 From: Dino Fejzagic Date: Sun, 10 May 2020 09:56:35 +0200 Subject: [PATCH 46/62] Implement runtime rendering mode switch --- .../WindowsMixedRealityHandControllerDataProvider.cs | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Runtime/Providers/InputSystem/Controllers/WindowsMixedRealityHandControllerDataProvider.cs b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Runtime/Providers/InputSystem/Controllers/WindowsMixedRealityHandControllerDataProvider.cs index c756f43..e4d0609 100644 --- a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Runtime/Providers/InputSystem/Controllers/WindowsMixedRealityHandControllerDataProvider.cs +++ b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Runtime/Providers/InputSystem/Controllers/WindowsMixedRealityHandControllerDataProvider.cs @@ -74,13 +74,6 @@ private SpatialInteractionManager SpatialInteractionManager #region IMixedRealityControllerDataProvider lifecycle implementation - /// - public override void Initialize() - { - base.Initialize(); - WindowsMixedRealityHandDataConverter.HandMeshingEnabled = RenderingMode == HandRenderingMode.Mesh; - } - /// public override void Update() { @@ -94,6 +87,8 @@ public override void Update() return; } + WindowsMixedRealityHandDataConverter.HandMeshingEnabled = RenderingMode == HandRenderingMode.Mesh; + bool isLeftHandTracked = false; bool isRightHandTracked = false; From c9f4c465ea6bc40e0886c841ae3721ff0c6f4796 Mon Sep 17 00:00:00 2001 From: Dino Fejzagic Date: Fri, 22 May 2020 08:45:14 +0200 Subject: [PATCH 47/62] Update converter to define platform capabilities --- .../WindowsMixedRealityHandDataConverter.cs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Runtime/Utilities/WindowsMixedRealityHandDataConverter.cs b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Runtime/Utilities/WindowsMixedRealityHandDataConverter.cs index 5413447..100f2f7 100644 --- a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Runtime/Utilities/WindowsMixedRealityHandDataConverter.cs +++ b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Runtime/Utilities/WindowsMixedRealityHandDataConverter.cs @@ -33,6 +33,18 @@ public sealed class WindowsMixedRealityHandDataConverter : BaseHandDataConverter public WindowsMixedRealityHandDataConverter(Handedness handedness, IReadOnlyList trackedPoses) : base(handedness, trackedPoses) { } + /// + protected override bool PlatformProvidesPointerPose => false; + + /// + protected override bool PlatformProvidesIsPinching => false; + + /// + protected override bool PlatformProvidesPinchStrength => false; + + /// + protected override bool PlatformProvidesIsPointing => false; + #if WINDOWS_UWP /// From b5eb70d735a9675228c623ebdcada4c803c47a48 Mon Sep 17 00:00:00 2001 From: Dino Fejzagic Date: Tue, 26 May 2020 21:33:53 +0200 Subject: [PATCH 48/62] Update wmr to use post processor --- ...sMixedRealityHandControllerDataProvider.cs | 19 +++++++++++---- .../WindowsMixedRealityHandDataConverter.cs | 24 ++++++------------- 2 files changed, 22 insertions(+), 21 deletions(-) diff --git a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Runtime/Providers/InputSystem/Controllers/WindowsMixedRealityHandControllerDataProvider.cs b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Runtime/Providers/InputSystem/Controllers/WindowsMixedRealityHandControllerDataProvider.cs index e4d0609..7275c48 100644 --- a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Runtime/Providers/InputSystem/Controllers/WindowsMixedRealityHandControllerDataProvider.cs +++ b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Runtime/Providers/InputSystem/Controllers/WindowsMixedRealityHandControllerDataProvider.cs @@ -41,10 +41,13 @@ public WindowsMixedRealityHandControllerDataProvider(string name, uint priority, { leftHandConverter = new WindowsMixedRealityHandDataConverter(Handedness.Left, TrackedPoses); rightHandConverter = new WindowsMixedRealityHandDataConverter(Handedness.Right, TrackedPoses); + + postProcessor = new HandDataPostProcessor(TrackedPoses); } private readonly WindowsMixedRealityHandDataConverter leftHandConverter; private readonly WindowsMixedRealityHandDataConverter rightHandConverter; + private readonly HandDataPostProcessor postProcessor; #if WINDOWS_UWP @@ -103,12 +106,16 @@ public override void Update() if (TryGetController(spatialInteractionSource.Handedness.ToHandedness(), out MixedRealityHandController leftHandController)) { - leftHandController.UpdateController(leftHandConverter.GetHandData(sourceState)); + var handData = leftHandConverter.GetHandData(sourceState); + postProcessor.PostProcess(handData); + leftHandController.UpdateController(handData); } else { leftHandController = CreateController(spatialInteractionSource); - leftHandController.UpdateController(leftHandConverter.GetHandData(sourceState)); + var handData = leftHandConverter.GetHandData(sourceState); + postProcessor.PostProcess(handData); + leftHandController.UpdateController(handData); } } @@ -118,12 +125,16 @@ public override void Update() if (TryGetController(spatialInteractionSource.Handedness.ToHandedness(), out MixedRealityHandController rightHandController)) { - rightHandController.UpdateController(rightHandConverter.GetHandData(sourceState)); + var handData = rightHandConverter.GetHandData(sourceState); + postProcessor.PostProcess(handData); + rightHandController.UpdateController(handData); } else { rightHandController = CreateController(spatialInteractionSource); - rightHandController.UpdateController(rightHandConverter.GetHandData(sourceState)); + var handData = rightHandConverter.GetHandData(sourceState); + postProcessor.PostProcess(handData); + rightHandController.UpdateController(handData); } } } diff --git a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Runtime/Utilities/WindowsMixedRealityHandDataConverter.cs b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Runtime/Utilities/WindowsMixedRealityHandDataConverter.cs index 100f2f7..396382e 100644 --- a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Runtime/Utilities/WindowsMixedRealityHandDataConverter.cs +++ b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Runtime/Utilities/WindowsMixedRealityHandDataConverter.cs @@ -4,7 +4,6 @@ using System.Collections.Generic; using XRTK.Definitions.Controllers.Hands; using XRTK.Definitions.Utilities; -using XRTK.Providers.Controllers.Hands; #if WINDOWS_UWP @@ -23,27 +22,19 @@ namespace XRTK.WindowsMixedReality.Utilities /// /// Converts windows mixed reality hand data to . /// - public sealed class WindowsMixedRealityHandDataConverter : BaseHandDataConverter + public sealed class WindowsMixedRealityHandDataConverter { /// /// Constructor. /// /// Handedness of the hand this converter is created for. /// The tracked poses collection to use for pose recognition. - public WindowsMixedRealityHandDataConverter(Handedness handedness, IReadOnlyList trackedPoses) : base(handedness, trackedPoses) - { } - - /// - protected override bool PlatformProvidesPointerPose => false; - - /// - protected override bool PlatformProvidesIsPinching => false; - - /// - protected override bool PlatformProvidesPinchStrength => false; + public WindowsMixedRealityHandDataConverter(Handedness handedness, IReadOnlyList trackedPoses) + { + this.handedness = handedness; + } - /// - protected override bool PlatformProvidesIsPointing => false; + private readonly Handedness handedness; #if WINDOWS_UWP @@ -102,7 +93,7 @@ public HandData GetHandData(SpatialInteractionSourceState spatialInteractionSour HandData updatedHandData = new HandData { IsTracked = handPose != null, - TimeStamp = DateTimeOffset.UtcNow.Ticks + UpdatedAt = DateTimeOffset.UtcNow.Ticks }; if (updatedHandData.IsTracked) @@ -206,7 +197,6 @@ public HandData GetHandData(SpatialInteractionSourceState spatialInteractionSour } } - PostProcess(updatedHandData); return updatedHandData; } From 1ede661f1a2cdc53b317eabc0e517941a7d78fe2 Mon Sep 17 00:00:00 2001 From: Dino Fejzagic Date: Tue, 26 May 2020 21:39:57 +0200 Subject: [PATCH 49/62] Fix build errors due to removal of base converter --- .../WindowsMixedRealityHandControllerDataProvider.cs | 4 ++-- .../Runtime/Utilities/WindowsMixedRealityHandDataConverter.cs | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Runtime/Providers/InputSystem/Controllers/WindowsMixedRealityHandControllerDataProvider.cs b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Runtime/Providers/InputSystem/Controllers/WindowsMixedRealityHandControllerDataProvider.cs index 7275c48..8fd75e8 100644 --- a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Runtime/Providers/InputSystem/Controllers/WindowsMixedRealityHandControllerDataProvider.cs +++ b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Runtime/Providers/InputSystem/Controllers/WindowsMixedRealityHandControllerDataProvider.cs @@ -39,8 +39,8 @@ public class WindowsMixedRealityHandControllerDataProvider : BaseHandControllerD public WindowsMixedRealityHandControllerDataProvider(string name, uint priority, WindowsMixedRealityHandControllerDataProviderProfile profile, IMixedRealityInputSystem parentService) : base(name, priority, profile, parentService) { - leftHandConverter = new WindowsMixedRealityHandDataConverter(Handedness.Left, TrackedPoses); - rightHandConverter = new WindowsMixedRealityHandDataConverter(Handedness.Right, TrackedPoses); + leftHandConverter = new WindowsMixedRealityHandDataConverter(Handedness.Left); + rightHandConverter = new WindowsMixedRealityHandDataConverter(Handedness.Right); postProcessor = new HandDataPostProcessor(TrackedPoses); } diff --git a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Runtime/Utilities/WindowsMixedRealityHandDataConverter.cs b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Runtime/Utilities/WindowsMixedRealityHandDataConverter.cs index 396382e..0ff959e 100644 --- a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Runtime/Utilities/WindowsMixedRealityHandDataConverter.cs +++ b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Runtime/Utilities/WindowsMixedRealityHandDataConverter.cs @@ -28,8 +28,7 @@ public sealed class WindowsMixedRealityHandDataConverter /// Constructor. /// /// Handedness of the hand this converter is created for. - /// The tracked poses collection to use for pose recognition. - public WindowsMixedRealityHandDataConverter(Handedness handedness, IReadOnlyList trackedPoses) + public WindowsMixedRealityHandDataConverter(Handedness handedness) { this.handedness = handedness; } From 345e86c0de3a6a1656cfbfaa9e5cfc771067cf56 Mon Sep 17 00:00:00 2001 From: Dino Fejzagic Date: Wed, 27 May 2020 10:43:45 +0200 Subject: [PATCH 50/62] Rename joints --- .../Extensions/HandJointKindExtensions.cs | 37 ++++++++++--------- .../WindowsMixedRealityHandDataConverter.cs | 2 +- 2 files changed, 20 insertions(+), 19 deletions(-) diff --git a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Runtime/Extensions/HandJointKindExtensions.cs b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Runtime/Extensions/HandJointKindExtensions.cs index 15e261f..caae038 100644 --- a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Runtime/Extensions/HandJointKindExtensions.cs +++ b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Runtime/Extensions/HandJointKindExtensions.cs @@ -3,6 +3,7 @@ #if WINDOWS_UWP +using System; using Windows.Perception.People; using XRTK.Definitions.Controllers.Hands; @@ -18,36 +19,36 @@ public static TrackedHandJoint ToTrackedHandJoint(this HandJointKind handJointKi case HandJointKind.Wrist: return TrackedHandJoint.Wrist; - case HandJointKind.ThumbMetacarpal: return TrackedHandJoint.ThumbMetacarpalJoint; - case HandJointKind.ThumbProximal: return TrackedHandJoint.ThumbProximalJoint; - case HandJointKind.ThumbDistal: return TrackedHandJoint.ThumbDistalJoint; + case HandJointKind.ThumbMetacarpal: return TrackedHandJoint.ThumbMetacarpal; + case HandJointKind.ThumbProximal: return TrackedHandJoint.ThumbProximal; + case HandJointKind.ThumbDistal: return TrackedHandJoint.ThumbDistal; case HandJointKind.ThumbTip: return TrackedHandJoint.ThumbTip; case HandJointKind.IndexMetacarpal: return TrackedHandJoint.IndexMetacarpal; - case HandJointKind.IndexProximal: return TrackedHandJoint.IndexKnuckle; - case HandJointKind.IndexIntermediate: return TrackedHandJoint.IndexMiddleJoint; - case HandJointKind.IndexDistal: return TrackedHandJoint.IndexDistalJoint; + case HandJointKind.IndexProximal: return TrackedHandJoint.IndexProximal; + case HandJointKind.IndexIntermediate: return TrackedHandJoint.IndexIntermediate; + case HandJointKind.IndexDistal: return TrackedHandJoint.IndexDistal; case HandJointKind.IndexTip: return TrackedHandJoint.IndexTip; case HandJointKind.MiddleMetacarpal: return TrackedHandJoint.MiddleMetacarpal; - case HandJointKind.MiddleProximal: return TrackedHandJoint.MiddleKnuckle; - case HandJointKind.MiddleIntermediate: return TrackedHandJoint.MiddleMiddleJoint; - case HandJointKind.MiddleDistal: return TrackedHandJoint.MiddleDistalJoint; + case HandJointKind.MiddleProximal: return TrackedHandJoint.MiddleProximal; + case HandJointKind.MiddleIntermediate: return TrackedHandJoint.MiddleIntermediate; + case HandJointKind.MiddleDistal: return TrackedHandJoint.MiddleDistal; case HandJointKind.MiddleTip: return TrackedHandJoint.MiddleTip; case HandJointKind.RingMetacarpal: return TrackedHandJoint.RingMetacarpal; - case HandJointKind.RingProximal: return TrackedHandJoint.RingKnuckle; - case HandJointKind.RingIntermediate: return TrackedHandJoint.RingMiddleJoint; - case HandJointKind.RingDistal: return TrackedHandJoint.RingDistalJoint; + case HandJointKind.RingProximal: return TrackedHandJoint.RingProximal; + case HandJointKind.RingIntermediate: return TrackedHandJoint.RingIntermediate; + case HandJointKind.RingDistal: return TrackedHandJoint.RingDistal; case HandJointKind.RingTip: return TrackedHandJoint.RingTip; - case HandJointKind.LittleMetacarpal: return TrackedHandJoint.PinkyMetacarpal; - case HandJointKind.LittleProximal: return TrackedHandJoint.PinkyKnuckle; - case HandJointKind.LittleIntermediate: return TrackedHandJoint.PinkyMiddleJoint; - case HandJointKind.LittleDistal: return TrackedHandJoint.PinkyDistalJoint; - case HandJointKind.LittleTip: return TrackedHandJoint.PinkyTip; + case HandJointKind.LittleMetacarpal: return TrackedHandJoint.LittleMetacarpal; + case HandJointKind.LittleProximal: return TrackedHandJoint.LittleProximal; + case HandJointKind.LittleIntermediate: return TrackedHandJoint.LittleIntermediate; + case HandJointKind.LittleDistal: return TrackedHandJoint.LittleDistal; + case HandJointKind.LittleTip: return TrackedHandJoint.LittleTip; - default: return TrackedHandJoint.None; + default: throw new ArgumentOutOfRangeException($"{typeof(HandJointKind).Name}.{handJointKind} could not be mapped to {typeof(TrackedHandJoint).Name}"); } } } diff --git a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Runtime/Utilities/WindowsMixedRealityHandDataConverter.cs b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Runtime/Utilities/WindowsMixedRealityHandDataConverter.cs index 0ff959e..659bd01 100644 --- a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Runtime/Utilities/WindowsMixedRealityHandDataConverter.cs +++ b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Runtime/Utilities/WindowsMixedRealityHandDataConverter.cs @@ -1,13 +1,13 @@ // Copyright (c) XRTK. All rights reserved. // Licensed under the MIT License. See LICENSE in the project root for license information. -using System.Collections.Generic; using XRTK.Definitions.Controllers.Hands; using XRTK.Definitions.Utilities; #if WINDOWS_UWP using System; +using System.Collections.Generic; using UnityEngine; using Windows.Perception.People; using Windows.UI.Input.Spatial; From a904684ea451f7568b2e4051e4d99a004515414a Mon Sep 17 00:00:00 2001 From: Dino Fejzagic Date: Wed, 27 May 2020 15:54:06 +0200 Subject: [PATCH 51/62] Point to new hand controller profiles --- ...owsMixedRealityHandControllerDataProviderProfile.asset | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Profiles~/Contollers/WindowsMixedRealityHandControllerDataProviderProfile.asset b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Profiles~/Contollers/WindowsMixedRealityHandControllerDataProviderProfile.asset index 6e9915b..2201dbc 100644 --- a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Profiles~/Contollers/WindowsMixedRealityHandControllerDataProviderProfile.asset +++ b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Profiles~/Contollers/WindowsMixedRealityHandControllerDataProviderProfile.asset @@ -11,12 +11,12 @@ MonoBehaviour: m_EditorHideFlags: 0 m_Script: {fileID: 11500000, guid: 29a54eda3f140e7418c5cb5c2bccd329, type: 3} m_Name: WindowsMixedRealityHandControllerDataProviderProfile - m_EditorClassIdentifier: + m_EditorClassIdentifier: hasSetupDefaults: 1 controllerMappingProfiles: - - {fileID: 11400000, guid: 777fb11f650654740825e1853e030405, type: 2} - - {fileID: 11400000, guid: 094680cae747ccb438c376af7ec85f32, type: 2} - handMeshingEnabled: 0 + - {fileID: 11400000, guid: dd499836e4b82f14da2f414aad1fed8b, type: 2} + - {fileID: 11400000, guid: 78bf44d2b6970a74ea2721883b0b22bc, type: 2} + renderingMode: 1 handPhysicsEnabled: 0 useTriggers: 0 boundsMode: 0 From d44f8261aad9e2d4d20c8b980bbf972fc8bbf67b Mon Sep 17 00:00:00 2001 From: Dino Fejzagic Date: Fri, 29 May 2020 18:33:34 +0200 Subject: [PATCH 52/62] Pass handedness to pose recognizer --- .../WindowsMixedRealityHandControllerDataProvider.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Runtime/Providers/InputSystem/Controllers/WindowsMixedRealityHandControllerDataProvider.cs b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Runtime/Providers/InputSystem/Controllers/WindowsMixedRealityHandControllerDataProvider.cs index 8fd75e8..1609152 100644 --- a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Runtime/Providers/InputSystem/Controllers/WindowsMixedRealityHandControllerDataProvider.cs +++ b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Runtime/Providers/InputSystem/Controllers/WindowsMixedRealityHandControllerDataProvider.cs @@ -107,14 +107,14 @@ public override void Update() if (TryGetController(spatialInteractionSource.Handedness.ToHandedness(), out MixedRealityHandController leftHandController)) { var handData = leftHandConverter.GetHandData(sourceState); - postProcessor.PostProcess(handData); + postProcessor.PostProcess(Handedness.Left, handData); leftHandController.UpdateController(handData); } else { leftHandController = CreateController(spatialInteractionSource); var handData = leftHandConverter.GetHandData(sourceState); - postProcessor.PostProcess(handData); + postProcessor.PostProcess(Handedness.Left, handData); leftHandController.UpdateController(handData); } } @@ -126,14 +126,14 @@ public override void Update() if (TryGetController(spatialInteractionSource.Handedness.ToHandedness(), out MixedRealityHandController rightHandController)) { var handData = rightHandConverter.GetHandData(sourceState); - postProcessor.PostProcess(handData); + postProcessor.PostProcess(Handedness.Right, handData); rightHandController.UpdateController(handData); } else { rightHandController = CreateController(spatialInteractionSource); var handData = rightHandConverter.GetHandData(sourceState); - postProcessor.PostProcess(handData); + postProcessor.PostProcess(Handedness.Right, handData); rightHandController.UpdateController(handData); } } From 6fe7b0b9e2eeb5fc55c4e1c9f67a57cf1c7bb695 Mon Sep 17 00:00:00 2001 From: Dino Fejzagic Date: Sun, 14 Jun 2020 20:28:57 +0200 Subject: [PATCH 53/62] Fix build errors --- ...sMixedRealityHandControllerDataProvider.cs | 10 ++++------ .../WindowsMixedRealityHandDataConverter.cs | 19 +++++++------------ 2 files changed, 11 insertions(+), 18 deletions(-) diff --git a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Runtime/Providers/Controllers/WindowsMixedRealityHandControllerDataProvider.cs b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Runtime/Providers/Controllers/WindowsMixedRealityHandControllerDataProvider.cs index f49da2a..d674474 100644 --- a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Runtime/Providers/Controllers/WindowsMixedRealityHandControllerDataProvider.cs +++ b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Runtime/Providers/Controllers/WindowsMixedRealityHandControllerDataProvider.cs @@ -89,8 +89,6 @@ public override void Update() return; } - WindowsMixedRealityHandDataConverter.HandMeshingEnabled = RenderingMode == HandRenderingMode.Mesh; - bool isLeftHandTracked = false; bool isRightHandTracked = false; @@ -105,14 +103,14 @@ public override void Update() if (TryGetController(spatialInteractionSource.Handedness.ToHandedness(), out var leftHandController)) { - var handData = leftHandConverter.GetHandData(sourceState); + var handData = leftHandConverter.GetHandData(sourceState, RenderingMode == HandRenderingMode.Mesh); postProcessor.PostProcess(Handedness.Left, handData); leftHandController.UpdateController(handData); } else { leftHandController = CreateController(spatialInteractionSource); - var handData = leftHandConverter.GetHandData(sourceState); + var handData = leftHandConverter.GetHandData(sourceState, RenderingMode == HandRenderingMode.Mesh); postProcessor.PostProcess(Handedness.Left, handData); leftHandController.UpdateController(handData); } @@ -124,14 +122,14 @@ public override void Update() if (TryGetController(spatialInteractionSource.Handedness.ToHandedness(), out var rightHandController)) { - var handData = rightHandConverter.GetHandData(sourceState); + var handData = rightHandConverter.GetHandData(sourceState, RenderingMode == HandRenderingMode.Mesh); postProcessor.PostProcess(Handedness.Right, handData); rightHandController.UpdateController(handData); } else { rightHandController = CreateController(spatialInteractionSource); - var handData = rightHandConverter.GetHandData(sourceState); + var handData = rightHandConverter.GetHandData(sourceState, RenderingMode == HandRenderingMode.Mesh); postProcessor.PostProcess(Handedness.Right, handData); rightHandController.UpdateController(handData); } diff --git a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Runtime/Utilities/WindowsMixedRealityHandDataConverter.cs b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Runtime/Utilities/WindowsMixedRealityHandDataConverter.cs index 03677da..3112e54 100644 --- a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Runtime/Utilities/WindowsMixedRealityHandDataConverter.cs +++ b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Runtime/Utilities/WindowsMixedRealityHandDataConverter.cs @@ -14,6 +14,7 @@ using XRTK.Services; using XRTK.WindowsMixedReality.Extensions; using XRTK.Extensions; +using XRTK.Definitions.Devices; #endif // WINDOWS_UWP @@ -37,11 +38,6 @@ public WindowsMixedRealityHandDataConverter(Handedness handedness) #if WINDOWS_UWP - /// - /// Gets or sets whether hand mesh data should be read and converted. - /// - public static bool HandMeshingEnabled { get; set; } - private readonly Vector3[] unityJointPositions = new Vector3[jointIndices.Length]; private readonly Quaternion[] unityJointOrientations = new Quaternion[jointIndices.Length]; private readonly Dictionary handMeshObservers = new Dictionary(); @@ -85,20 +81,21 @@ public WindowsMixedRealityHandDataConverter(Handedness handedness) /// Gets updated hand data for the current frame. /// /// Platform provided current input source state for the hand. + /// If set, hand mesh information will be included in . /// Platform agnostics hand data. - public HandData GetHandData(SpatialInteractionSourceState spatialInteractionSourceState) + public HandData GetHandData(SpatialInteractionSourceState spatialInteractionSourceState, bool includeMeshData) { HandPose handPose = spatialInteractionSourceState.TryGetHandPose(); HandData updatedHandData = new HandData { - IsTracked = handPose != null, + TrackingState = handPose != null ? TrackingState.Tracked : TrackingState.NotTracked, UpdatedAt = DateTimeOffset.UtcNow.Ticks }; - if (updatedHandData.IsTracked) + if (updatedHandData.TrackingState == TrackingState.Tracked) { // Accessing the hand mesh data involves copying quite a bit of data, so only do it if application requests it. - if (HandMeshingEnabled) + if (includeMeshData) { if (!handMeshObservers.ContainsKey(spatialInteractionSourceState.Source.Handedness) && !HasRequestedHandMeshObserver(spatialInteractionSourceState.Source.Handedness)) @@ -154,9 +151,7 @@ public HandData GetHandData(SpatialInteractionSourceState spatialInteractionSour handMeshVertices, handMeshTriangleIndices, handMeshNormals, - handMeshUVs, - translation.ToUnity(), - rotation.ToUnity()); + handMeshUVs); } } } From f8c46f7ecb3122efe21f72c27b6cc8af8db597a6 Mon Sep 17 00:00:00 2001 From: Dino Fejzagic Date: Sun, 21 Jun 2020 21:46:03 +0200 Subject: [PATCH 54/62] Update WMR converter to latest changes --- ...sMixedRealityHandControllerDataProvider.cs | 89 +++++++---------- .../WindowsMixedRealityHandDataConverter.cs | 96 ++++++++++++------- 2 files changed, 95 insertions(+), 90 deletions(-) diff --git a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Runtime/Providers/Controllers/WindowsMixedRealityHandControllerDataProvider.cs b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Runtime/Providers/Controllers/WindowsMixedRealityHandControllerDataProvider.cs index d674474..8f42119 100644 --- a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Runtime/Providers/Controllers/WindowsMixedRealityHandControllerDataProvider.cs +++ b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Runtime/Providers/Controllers/WindowsMixedRealityHandControllerDataProvider.cs @@ -6,7 +6,6 @@ using XRTK.Interfaces.InputSystem; using XRTK.Providers.Controllers.Hands; using XRTK.WindowsMixedReality.Profiles; -using XRTK.Definitions.Utilities; using XRTK.WindowsMixedReality.Utilities; #if WINDOWS_UWP @@ -21,6 +20,7 @@ using XRTK.Services; using XRTK.WindowsMixedReality.Extensions; using XRTK.Definitions.Controllers.Hands; +using XRTK.Definitions.Utilities; #endif // WINDOWS_UWP @@ -38,14 +38,11 @@ public class WindowsMixedRealityHandControllerDataProvider : BaseHandControllerD public WindowsMixedRealityHandControllerDataProvider(string name, uint priority, WindowsMixedRealityHandControllerDataProviderProfile profile, IMixedRealityInputSystem parentService) : base(name, priority, profile, parentService) { - leftHandConverter = new WindowsMixedRealityHandDataConverter(Handedness.Left); - rightHandConverter = new WindowsMixedRealityHandDataConverter(Handedness.Right); - + handDataProvider = new WindowsMixedRealityHandDataConverter(); postProcessor = new HandDataPostProcessor(TrackedPoses); } - private readonly WindowsMixedRealityHandDataConverter leftHandConverter; - private readonly WindowsMixedRealityHandDataConverter rightHandConverter; + private readonly WindowsMixedRealityHandDataConverter handDataProvider; private readonly HandDataPostProcessor postProcessor; #if WINDOWS_UWP @@ -81,58 +78,36 @@ public override void Update() { base.Update(); - // Update existing controllers or create a new one if needed. - var sources = GetCurrentSources(); - - if (sources == null) - { - return; - } - bool isLeftHandTracked = false; bool isRightHandTracked = false; - for (int i = 0; i < sources.Count; i++) + if (TryGetCurrentHandSources(out var sources)) { - var sourceState = sources[i]; - var spatialInteractionSource = sourceState.Source; - - if (spatialInteractionSource.Handedness == SpatialInteractionSourceHandedness.Left) + for (int i = 0; i < sources.Count; i++) { - isLeftHandTracked = true; + var sourceState = sources[i]; + var spatialInteractionSource = sourceState.Source; + var handedness = spatialInteractionSource.Handedness.ToHandedness(); - if (TryGetController(spatialInteractionSource.Handedness.ToHandedness(), out var leftHandController)) + if (!TryGetController(handedness, out MixedRealityHandController controller)) { - var handData = leftHandConverter.GetHandData(sourceState, RenderingMode == HandRenderingMode.Mesh); - postProcessor.PostProcess(Handedness.Left, handData); - leftHandController.UpdateController(handData); + controller = CreateController(spatialInteractionSource); } - else - { - leftHandController = CreateController(spatialInteractionSource); - var handData = leftHandConverter.GetHandData(sourceState, RenderingMode == HandRenderingMode.Mesh); - postProcessor.PostProcess(Handedness.Left, handData); - leftHandController.UpdateController(handData); - } - } - - if (spatialInteractionSource.Handedness == SpatialInteractionSourceHandedness.Right) - { - isRightHandTracked = true; - if (TryGetController(spatialInteractionSource.Handedness.ToHandedness(), out var rightHandController)) + if (handDataProvider.TryGetHandData(sourceState, RenderingMode == HandRenderingMode.Mesh, out var handData)) { - var handData = rightHandConverter.GetHandData(sourceState, RenderingMode == HandRenderingMode.Mesh); - postProcessor.PostProcess(Handedness.Right, handData); - rightHandController.UpdateController(handData); - } - else - { - rightHandController = CreateController(spatialInteractionSource); - var handData = rightHandConverter.GetHandData(sourceState, RenderingMode == HandRenderingMode.Mesh); - postProcessor.PostProcess(Handedness.Right, handData); - rightHandController.UpdateController(handData); + if (handedness == Handedness.Left) + { + isLeftHandTracked = true; + } + else if (handedness == Handedness.Right) + { + isRightHandTracked = true; + } } + + handData = postProcessor.PostProcess(handedness, handData); + controller.UpdateController(handData); } } @@ -168,23 +143,31 @@ public override void Disable() /// Reads currently detected input sources by the current instance. /// /// List of sources. Can be null. - private IReadOnlyList GetCurrentSources() + private bool TryGetCurrentHandSources(out IReadOnlyList sources) { // Articulated hand support is only present in the 18362 version and beyond Windows // SDK (which contains the V8 drop of the Universal API Contract). In particular, // the HandPose related APIs are only present on this version and above. - if (XRTK.WindowsMixedReality.Utilities.WindowsApiChecker.UniversalApiContractV8_IsAvailable && SpatialInteractionManager != null) + // GetForCurrentView and GetDetectedSourcesAtTimestamp were both introduced in the same Windows version. + // We need only check for one of them. + if (WindowsApiChecker.IsMethodAvailable( + "Windows.UI.Input.Spatial", + "SpatialInteractionManager", + "GetForCurrentView") && + SpatialInteractionManager != null) { var perceptionTimestamp = PerceptionTimestampHelper.FromHistoricalTargetTime(DateTimeOffset.Now); - var sources = SpatialInteractionManager.GetDetectedSourcesAtTimestamp(perceptionTimestamp); + var allSources = SpatialInteractionManager.GetDetectedSourcesAtTimestamp(perceptionTimestamp); - if (sources != null) + if (allSources != null) { - return sources.Where(s => s.Source.Kind == SpatialInteractionSourceKind.Hand).ToList(); + sources = allSources.Where(s => s.Source.Kind == SpatialInteractionSourceKind.Hand).ToList(); + return true; } } - return null; + sources = null; + return false; } private bool TryGetController(Handedness handedness, out MixedRealityHandController controller) diff --git a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Runtime/Utilities/WindowsMixedRealityHandDataConverter.cs b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Runtime/Utilities/WindowsMixedRealityHandDataConverter.cs index 3112e54..d5483ff 100644 --- a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Runtime/Utilities/WindowsMixedRealityHandDataConverter.cs +++ b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Runtime/Utilities/WindowsMixedRealityHandDataConverter.cs @@ -25,22 +25,10 @@ namespace XRTK.WindowsMixedReality.Utilities /// public sealed class WindowsMixedRealityHandDataConverter { - /// - /// Constructor. - /// - /// Handedness of the hand this converter is created for. - public WindowsMixedRealityHandDataConverter(Handedness handedness) - { - this.handedness = handedness; - } - - private readonly Handedness handedness; - #if WINDOWS_UWP - private readonly Vector3[] unityJointPositions = new Vector3[jointIndices.Length]; - private readonly Quaternion[] unityJointOrientations = new Quaternion[jointIndices.Length]; private readonly Dictionary handMeshObservers = new Dictionary(); + private readonly MixedRealityPose[] jointPoses = new MixedRealityPose[HandData.JointCount]; private int[] handMeshTriangleIndices = null; private bool hasRequestedHandMeshObserverLeftHand = false; @@ -82,19 +70,34 @@ public WindowsMixedRealityHandDataConverter(Handedness handedness) /// /// Platform provided current input source state for the hand. /// If set, hand mesh information will be included in . - /// Platform agnostics hand data. - public HandData GetHandData(SpatialInteractionSourceState spatialInteractionSourceState, bool includeMeshData) + /// The output . + /// True, if data conversion was a success. + public bool TryGetHandData(SpatialInteractionSourceState spatialInteractionSourceState, bool includeMeshData, out HandData handData) { + // Here we check whether the hand is being tracked at all by the WMR system. HandPose handPose = spatialInteractionSourceState.TryGetHandPose(); - HandData updatedHandData = new HandData + if (handPose == null) + { + handData = default; + return false; + } + + // The hand is being tracked, next we verify it meets our confidence requirements to consider + // it tracked. + var platformJointPoses = new JointPose[jointIndices.Length]; + handData = new HandData { - TrackingState = handPose != null ? TrackingState.Tracked : TrackingState.NotTracked, + TrackingState = handPose.TryGetJoints(WindowsMixedRealityUtilities.SpatialCoordinateSystem, jointIndices, platformJointPoses) ? TrackingState.Tracked : TrackingState.NotTracked, UpdatedAt = DateTimeOffset.UtcNow.Ticks }; - if (updatedHandData.TrackingState == TrackingState.Tracked) + // If the hand is tracked per requirements, we get updated joint data + // and other data needed for updating the hand controller's state. + if (handData.TrackingState == TrackingState.Tracked) { - // Accessing the hand mesh data involves copying quite a bit of data, so only do it if application requests it. + handData.Joints = GetJointPoses(platformJointPoses); + + Accessing the hand mesh data involves copying quite a bit of data, so only do it if application requests it. if (includeMeshData) { if (!handMeshObservers.ContainsKey(spatialInteractionSourceState.Source.Handedness) && @@ -147,7 +150,7 @@ public HandData GetHandData(SpatialInteractionSourceState spatialInteractionSour handMeshNormals[i] = vertexAndNormals[i].Normal.ToUnity(); } - updatedHandData.Mesh = new HandMeshData( + handData.Mesh = new HandMeshData( handMeshVertices, handMeshTriangleIndices, handMeshNormals, @@ -169,27 +172,46 @@ public HandData GetHandData(SpatialInteractionSourceState spatialInteractionSour handMeshObservers.Remove(spatialInteractionSourceState.Source.Handedness); } + } - JointPose[] jointPoses = new JointPose[jointIndices.Length]; - if (handPose.TryGetJoints(WindowsMixedRealityUtilities.SpatialCoordinateSystem, jointIndices, jointPoses)) - { - for (int i = 0; i < jointPoses.Length; i++) - { - unityJointOrientations[i] = jointPoses[i].Orientation.ToUnity(); - unityJointPositions[i] = jointPoses[i].Position.ToUnity(); - - // We want the controller to follow the Playspace, so fold in the playspace transform here to - // put the controller pose into world space. - unityJointPositions[i] = MixedRealityToolkit.CameraSystem.MainCameraRig.PlayspaceTransform.TransformPoint(unityJointPositions[i]); - unityJointOrientations[i] = MixedRealityToolkit.CameraSystem.MainCameraRig.PlayspaceTransform.rotation * unityJointOrientations[i]; + // Even if the hand is being tracked by the system but the confidence did not + // meet our requirements, we return true. This allows the hand controller and visualizers + // to react to tracking loss and keep the hand up for a given time before destroying the controller. + return true; + } - TrackedHandJoint handJoint = jointIndices[i].ToTrackedHandJoint(); - updatedHandData.Joints[(int)handJoint] = new MixedRealityPose(unityJointPositions[i], unityJointOrientations[i]); - } - } + /// + /// Gets updated joint poses for all s. + /// + /// Joint poses retrieved from the platform. + /// Joint poses in order. + private MixedRealityPose[] GetJointPoses(JointPose[] platformJointPoses) + { + for (int i = 0; i < platformJointPoses.Length; i++) + { + var handJoint = jointIndices[i].ToTrackedHandJoint(); + jointPoses[(int)handJoint] = GetJointPose(platformJointPoses[i]); } - return updatedHandData; + return jointPoses; + } + + /// + /// Gets a single joint's pose relative to the hand root pose. + /// + /// Joint pose data retrieved from the platform. + /// Converted joint pose in hand space. + private MixedRealityPose GetJointPose(JointPose jointPose) + { + var jointPosition = jointPose.Position.ToUnity(); + var jointRotation = jointPose.Orientation.ToUnity(); + + // We want the controller to follow the Playspace, so fold in the playspace transform here to + // put the controller pose into world space. + jointPosition = MixedRealityToolkit.CameraSystem.MainCameraRig.PlayspaceTransform.TransformPoint(jointPosition); + jointRotation = MixedRealityToolkit.CameraSystem.MainCameraRig.PlayspaceTransform.rotation * jointRotation; + + return new MixedRealityPose(jointPosition, jointRotation); } private void InitializeHandMeshUVs(Vector3[] neutralPoseVertices) From 90ca18846b4f926edf0d6ae71b4700d51da85861 Mon Sep 17 00:00:00 2001 From: Dino Fejzagic Date: Wed, 15 Jul 2020 21:13:25 +0200 Subject: [PATCH 55/62] Update wmr hand data provider --- .../WindowsMixedRealityHandDataConverter.cs | 218 +++++++++++------- 1 file changed, 138 insertions(+), 80 deletions(-) diff --git a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Runtime/Utilities/WindowsMixedRealityHandDataConverter.cs b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Runtime/Utilities/WindowsMixedRealityHandDataConverter.cs index d5483ff..ca012fa 100644 --- a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Runtime/Utilities/WindowsMixedRealityHandDataConverter.cs +++ b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Runtime/Utilities/WindowsMixedRealityHandDataConverter.cs @@ -15,13 +15,14 @@ using XRTK.WindowsMixedReality.Extensions; using XRTK.Extensions; using XRTK.Definitions.Devices; +using XRTK.Utilities; #endif // WINDOWS_UWP namespace XRTK.WindowsMixedReality.Utilities { /// - /// Converts windows mixed reality hand data to . + /// Converts windows mixed reality hand data to XRTK's . /// public sealed class WindowsMixedRealityHandDataConverter { @@ -95,82 +96,32 @@ public bool TryGetHandData(SpatialInteractionSourceState spatialInteractionSourc // and other data needed for updating the hand controller's state. if (handData.TrackingState == TrackingState.Tracked) { - handData.Joints = GetJointPoses(platformJointPoses); + handData.RootPose = GetHandRootPose(platformJointPoses); + handData.Joints = GetJointPoses(platformJointPoses, handData.RootPose); - Accessing the hand mesh data involves copying quite a bit of data, so only do it if application requests it. - if (includeMeshData) + if (includeMeshData && TryGetUpdatedHandMeshData(spatialInteractionSourceState, handPose, out HandMeshData data)) { - if (!handMeshObservers.ContainsKey(spatialInteractionSourceState.Source.Handedness) && - !HasRequestedHandMeshObserver(spatialInteractionSourceState.Source.Handedness)) - { - SetHandMeshObserver(spatialInteractionSourceState); - } - - if (handMeshObservers.TryGetValue(spatialInteractionSourceState.Source.Handedness, out var handMeshObserver) && handMeshTriangleIndices == null) + handData.Mesh = data; + } + else + { + // if hand mesh visualization is disabled make sure to destroy our hand mesh observer + // if it has already been created. + if (handMeshObservers.ContainsKey(spatialInteractionSourceState.Source.Handedness)) { - var indexCount = handMeshObserver.TriangleIndexCount; - var indices = new ushort[indexCount]; - handMeshObserver.GetTriangleIndices(indices); - handMeshTriangleIndices = new int[indexCount]; - Array.Copy(indices, handMeshTriangleIndices, (int)handMeshObserver.TriangleIndexCount); - - // Compute neutral pose - var neutralPoseVertices = new Vector3[handMeshObserver.VertexCount]; - var neutralPose = handMeshObserver.NeutralPose; - var vertexAndNormals = new HandMeshVertex[handMeshObserver.VertexCount]; - var handMeshVertexState = handMeshObserver.GetVertexStateForPose(neutralPose); - handMeshVertexState.GetVertices(vertexAndNormals); - - for (int i = 0; i < handMeshObserver.VertexCount; i++) + if (spatialInteractionSourceState.Source.Handedness == SpatialInteractionSourceHandedness.Left) { - neutralPoseVertices[i] = vertexAndNormals[i].Position.ToUnity(); + hasRequestedHandMeshObserverLeftHand = false; } - - // Compute UV mapping - InitializeHandMeshUVs(neutralPoseVertices); - } - - if (handMeshObserver != null && handMeshTriangleIndices != null) - { - var vertexAndNormals = new HandMeshVertex[handMeshObserver.VertexCount]; - var handMeshVertexState = handMeshObserver.GetVertexStateForPose(handPose); - handMeshVertexState.GetVertices(vertexAndNormals); - - var meshTransform = handMeshVertexState.CoordinateSystem.TryGetTransformTo(WindowsMixedRealityUtilities.SpatialCoordinateSystem); - if (meshTransform.HasValue) + else if (spatialInteractionSourceState.Source.Handedness == SpatialInteractionSourceHandedness.Right) { - System.Numerics.Matrix4x4.Decompose(meshTransform.Value, out var scale, out var rotation, out var translation); - - var handMeshVertices = new Vector3[handMeshObserver.VertexCount]; - var handMeshNormals = new Vector3[handMeshObserver.VertexCount]; - - for (int i = 0; i < handMeshObserver.VertexCount; i++) - { - handMeshVertices[i] = vertexAndNormals[i].Position.ToUnity(); - handMeshNormals[i] = vertexAndNormals[i].Normal.ToUnity(); - } - - handData.Mesh = new HandMeshData( - handMeshVertices, - handMeshTriangleIndices, - handMeshNormals, - handMeshUVs); + hasRequestedHandMeshObserverRightHand = false; } - } - } - else if (handMeshObservers.ContainsKey(spatialInteractionSourceState.Source.Handedness)) - { - // if hand mesh visualization is disabled make sure to destroy our hand mesh observer if it has already been created - if (spatialInteractionSourceState.Source.Handedness == SpatialInteractionSourceHandedness.Left) - { - hasRequestedHandMeshObserverLeftHand = false; - } - else if (spatialInteractionSourceState.Source.Handedness == SpatialInteractionSourceHandedness.Right) - { - hasRequestedHandMeshObserverRightHand = false; + + handMeshObservers.Remove(spatialInteractionSourceState.Source.Handedness); } - handMeshObservers.Remove(spatialInteractionSourceState.Source.Handedness); + handData.Mesh = HandMeshData.Empty; } } @@ -184,13 +135,14 @@ public bool TryGetHandData(SpatialInteractionSourceState spatialInteractionSourc /// Gets updated joint poses for all s. /// /// Joint poses retrieved from the platform. + /// The hand's root pose. /// Joint poses in order. - private MixedRealityPose[] GetJointPoses(JointPose[] platformJointPoses) + private MixedRealityPose[] GetJointPoses(JointPose[] platformJointPoses, MixedRealityPose handRootPose) { for (int i = 0; i < platformJointPoses.Length; i++) { var handJoint = jointIndices[i].ToTrackedHandJoint(); - jointPoses[(int)handJoint] = GetJointPose(platformJointPoses[i]); + jointPoses[(int)handJoint] = GetJointPose(platformJointPoses[i], handRootPose); } return jointPoses; @@ -200,20 +152,128 @@ private MixedRealityPose[] GetJointPoses(JointPose[] platformJointPoses) /// Gets a single joint's pose relative to the hand root pose. /// /// Joint pose data retrieved from the platform. + /// The hand's root pose. /// Converted joint pose in hand space. - private MixedRealityPose GetJointPose(JointPose jointPose) + private MixedRealityPose GetJointPose(JointPose jointPose, MixedRealityPose handRootPose) { var jointPosition = jointPose.Position.ToUnity(); var jointRotation = jointPose.Orientation.ToUnity(); // We want the controller to follow the Playspace, so fold in the playspace transform here to - // put the controller pose into world space. - jointPosition = MixedRealityToolkit.CameraSystem.MainCameraRig.PlayspaceTransform.TransformPoint(jointPosition); - jointRotation = MixedRealityToolkit.CameraSystem.MainCameraRig.PlayspaceTransform.rotation * jointRotation; + // put the controller pose into world space. We also want all joint poses to be + // relative to the hand's root pose, so we account for that as well. + var playspaceTransform = MixedRealityToolkit.CameraSystem.MainCameraRig.PlayspaceTransform; + var cameraTransform = MixedRealityToolkit.CameraSystem != null + ? MixedRealityToolkit.CameraSystem.MainCameraRig.PlayerCamera.transform + : CameraCache.Main.transform; + + jointPosition = playspaceTransform.TransformPoint(jointPosition) - handRootPose.Position; + //jointRotation = playspaceTransform.rotation * jointRotation; + //Quaternion.Inverse(handRootPose.Rotation) * return new MixedRealityPose(jointPosition, jointRotation); } + /// + /// Gets the hand's root pose. + /// + /// Joint poses retrieved from the platform. + /// The hands value. + private MixedRealityPose GetHandRootPose(JointPose[] platformJointPoses) + { + // For WMR we use the wrist pose as the hand root pose. + var wristPose = platformJointPoses[(int)HandJointKind.Wrist]; + + var playspaceTransform = MixedRealityToolkit.CameraSystem.MainCameraRig.PlayspaceTransform; + var cameraTransform = MixedRealityToolkit.CameraSystem != null + ? MixedRealityToolkit.CameraSystem.MainCameraRig.PlayerCamera.transform + : CameraCache.Main.transform; + + // Convert to playspace. + var rootPosition = playspaceTransform.InverseTransformPoint(playspaceTransform.position + playspaceTransform.rotation * wristPose.Position.ToUnity()); + var rootRotation = Quaternion.Inverse(playspaceTransform.rotation) * playspaceTransform.rotation * wristPose.Orientation.ToUnity(); + + // Transform to camera space. + Debug.Log($"Camera: {cameraTransform.localPosition}"); + Debug.Log($"Hand Before: {rootPosition}"); + rootPosition.y += cameraTransform.position.y; + Debug.Log($"Hand After: {rootPosition}"); + + return new MixedRealityPose(rootPosition, rootRotation); + } + + /// + /// Attempts to get updated hand mesh data. + /// + /// Platform provided current input source state for the hand. + /// Hand pose information retrieved for joint conversion. + /// Mesh information retrieved in case of success. + /// True, if mesh data could be loaded. + private bool TryGetUpdatedHandMeshData(SpatialInteractionSourceState spatialInteractionSourceState, HandPose handPose, out HandMeshData data) + { + if (!handMeshObservers.ContainsKey(spatialInteractionSourceState.Source.Handedness) && + !HasRequestedHandMeshObserver(spatialInteractionSourceState.Source.Handedness)) + { + SetHandMeshObserver(spatialInteractionSourceState); + } + + if (handMeshObservers.TryGetValue(spatialInteractionSourceState.Source.Handedness, out var handMeshObserver) && handMeshTriangleIndices == null) + { + var indexCount = handMeshObserver.TriangleIndexCount; + var indices = new ushort[indexCount]; + handMeshObserver.GetTriangleIndices(indices); + handMeshTriangleIndices = new int[indexCount]; + Array.Copy(indices, handMeshTriangleIndices, (int)handMeshObserver.TriangleIndexCount); + + // Compute neutral pose + var neutralPoseVertices = new Vector3[handMeshObserver.VertexCount]; + var neutralPose = handMeshObserver.NeutralPose; + var vertexAndNormals = new HandMeshVertex[handMeshObserver.VertexCount]; + var handMeshVertexState = handMeshObserver.GetVertexStateForPose(neutralPose); + handMeshVertexState.GetVertices(vertexAndNormals); + + for (int i = 0; i < handMeshObserver.VertexCount; i++) + { + neutralPoseVertices[i] = vertexAndNormals[i].Position.ToUnity(); + } + + // Compute UV mapping + InitializeHandMeshUVs(neutralPoseVertices); + } + + if (handMeshObserver != null && handMeshTriangleIndices != null) + { + var vertexAndNormals = new HandMeshVertex[handMeshObserver.VertexCount]; + var handMeshVertexState = handMeshObserver.GetVertexStateForPose(handPose); + handMeshVertexState.GetVertices(vertexAndNormals); + + var meshTransform = handMeshVertexState.CoordinateSystem.TryGetTransformTo(WindowsMixedRealityUtilities.SpatialCoordinateSystem); + if (meshTransform.HasValue) + { + System.Numerics.Matrix4x4.Decompose(meshTransform.Value, out var scale, out var rotation, out var translation); + + var handMeshVertices = new Vector3[handMeshObserver.VertexCount]; + var handMeshNormals = new Vector3[handMeshObserver.VertexCount]; + + for (int i = 0; i < handMeshObserver.VertexCount; i++) + { + handMeshVertices[i] = vertexAndNormals[i].Position.ToUnity(); + handMeshNormals[i] = vertexAndNormals[i].Normal.ToUnity(); + } + + data = new HandMeshData( + handMeshVertices, + handMeshTriangleIndices, + handMeshNormals, + handMeshUVs); + + return true; + } + } + + return false; + } + private void InitializeHandMeshUVs(Vector3[] neutralPoseVertices) { if (neutralPoseVertices.Length == 0) @@ -270,12 +330,10 @@ private async void SetHandMeshObserver(SpatialInteractionSourceState sourceState hasRequestedHandMeshObserverRightHand = sourceState.Source.Handedness == SpatialInteractionSourceHandedness.Right; } - private bool HasRequestedHandMeshObserver(SpatialInteractionSourceHandedness handedness) - { - return handedness == SpatialInteractionSourceHandedness.Left - ? hasRequestedHandMeshObserverLeftHand - : handedness == SpatialInteractionSourceHandedness.Right && hasRequestedHandMeshObserverRightHand; - } + private bool HasRequestedHandMeshObserver(SpatialInteractionSourceHandedness handedness) => + handedness == SpatialInteractionSourceHandedness.Left ? + hasRequestedHandMeshObserverLeftHand : + handedness == SpatialInteractionSourceHandedness.Right && hasRequestedHandMeshObserverRightHand; #endif // WINDOWS_UWP } From 976cbcdaf6cb6e7562583c1fa3c34a7b48309dbd Mon Sep 17 00:00:00 2001 From: Dino Fejzagic Date: Wed, 15 Jul 2020 21:13:56 +0200 Subject: [PATCH 56/62] Temp update WindowsApiChecker --- ...owsMixedRealityCameraProviderProfile.asset | 2 +- .../Extensions/InteractionSourceExtensions.cs | 16 +++- ...ndowsMixedRealityControllerDataProvider.cs | 18 +++- .../Runtime/Utilities/WindowsApiChecker.cs | 95 ++++++++++--------- 4 files changed, 83 insertions(+), 48 deletions(-) diff --git a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Profiles~/CameraSystem/WindowsMixedRealityCameraProviderProfile.asset b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Profiles~/CameraSystem/WindowsMixedRealityCameraProviderProfile.asset index b2c53a0..ac1cba3 100644 --- a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Profiles~/CameraSystem/WindowsMixedRealityCameraProviderProfile.asset +++ b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Profiles~/CameraSystem/WindowsMixedRealityCameraProviderProfile.asset @@ -17,7 +17,7 @@ MonoBehaviour: cameraClearFlagsOpaqueDisplay: 1 backgroundColorOpaqueDisplay: {r: 0, g: 0, b: 0, a: 1} opaqueQualityLevel: 0 - nearClipPlaneTransparentDisplay: 0.2 + nearClipPlaneTransparentDisplay: 0.05 cameraClearFlagsTransparentDisplay: 2 backgroundColorTransparentDisplay: {r: 0, g: 0, b: 0, a: 0} transparentQualityLevel: 0 diff --git a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Runtime/Extensions/InteractionSourceExtensions.cs b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Runtime/Extensions/InteractionSourceExtensions.cs index d94376d..5d3eab0 100644 --- a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Runtime/Extensions/InteractionSourceExtensions.cs +++ b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Runtime/Extensions/InteractionSourceExtensions.cs @@ -42,7 +42,13 @@ public static void StartHaptics(this InteractionSource interactionSource, float public static void StartHaptics(this InteractionSource interactionSource, float intensity, float durationInSeconds) { - if (!WindowsApiChecker.UniversalApiContractV4_IsAvailable && !Application.isEditor) + // GetForCurrentView and GetDetectedSourcesAtTimestamp were both introduced in the same Windows version. + // We need only check for one of them. + if ((!WindowsApiChecker.IsMethodAvailable( + "Windows.UI.Input.Spatial", + "SpatialInteractionManager", + "GetForCurrentView") || + !WindowsApiChecker.IsTypeAvailable("Windows.Devices.Haptics", "SimpleHapticsController")) && !Application.isEditor) { return; } @@ -82,7 +88,13 @@ public static void StartHaptics(this InteractionSource interactionSource, float public static void StopHaptics(this InteractionSource interactionSource) { - if (!WindowsApiChecker.UniversalApiContractV4_IsAvailable && !Application.isEditor) + // GetForCurrentView and GetDetectedSourcesAtTimestamp were both introduced in the same Windows version. + // We need only check for one of them. + if ((!WindowsApiChecker.IsMethodAvailable( + "Windows.UI.Input.Spatial", + "SpatialInteractionManager", + "GetForCurrentView") || + !WindowsApiChecker.IsTypeAvailable("Windows.Devices.Haptics", "SimpleHapticsController")) && !Application.isEditor) { return; } diff --git a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Runtime/Providers/Controllers/WindowsMixedRealityControllerDataProvider.cs b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Runtime/Providers/Controllers/WindowsMixedRealityControllerDataProvider.cs index 752e3b2..b7f57e1 100644 --- a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Runtime/Providers/Controllers/WindowsMixedRealityControllerDataProvider.cs +++ b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Runtime/Providers/Controllers/WindowsMixedRealityControllerDataProvider.cs @@ -440,10 +440,24 @@ private WindowsMixedRealityMotionController GetController(InteractionSource inte private static async void TryRenderControllerModel(InteractionSource interactionSource, WindowsMixedRealityMotionController controller) { #if WINDOWS_UWP - if (!UnityEngine.XR.WSA.HolographicSettings.IsDisplayOpaque) { return; } + if (!UnityEngine.XR.WSA.HolographicSettings.IsDisplayOpaque) + { + return; + } + IRandomAccessStreamWithContentType stream = null; - if (!WindowsApiChecker.UniversalApiContractV5_IsAvailable) { return; } + if (!WindowsApiChecker.IsMethodAvailable( + "Windows.UI.Input.Spatial", + "SpatialInteractionManager", + "GetForCurrentView") || + !WindowsApiChecker.IsMethodAvailable( + "Windows.UI.Input.Spatial", + "SpatialInteractionController", + "TryGetRenderableModelAsync")) + { + return; + } await CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, DispatchedHandler); diff --git a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Runtime/Utilities/WindowsApiChecker.cs b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Runtime/Utilities/WindowsApiChecker.cs index 965e94c..44332e2 100644 --- a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Runtime/Utilities/WindowsApiChecker.cs +++ b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Runtime/Utilities/WindowsApiChecker.cs @@ -1,65 +1,74 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See LICENSE in the project root for license information. -using UnityEngine; +#if WINDOWS_UWP +using Windows.Foundation.Metadata; +#elif (UNITY_WSA && DOTNETWINRT_PRESENT) +using Microsoft.Windows.Foundation.Metadata; +#endif // WINDOWS_UWP namespace XRTK.WindowsMixedReality.Utilities { /// /// Helper class for determining if a Windows API contract is available. /// - /// See https://docs.microsoft.com/en-us/uwp/extension-sdks/windows-universal-sdk + /// See https://docs.microsoft.com/uwp/extension-sdks/windows-universal-sdk /// for a full list of contracts. public static class WindowsApiChecker { - [RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSceneLoad)] - public static void CheckApiContracts() + /// + /// Checks to see if the requested method is present on the current platform. + /// + /// The namespace (ex: "Windows.UI.Input.Spatial") containing the class. + /// The name of the class containing the method (ex: "SpatialInteractionMananger"). + /// The name of the method (ex: "IsSourceKindSupported"). + /// True if the method is available and can be called. Otherwise, false. + public static bool IsMethodAvailable( + string namespaceName, + string className, + string methodName) { -#if WINDOWS_UWP - UniversalApiContractV8_IsAvailable = Windows.Foundation.Metadata.ApiInformation.IsApiContractPresent(nameof(Windows.Foundation.UniversalApiContract), 8); - UniversalApiContractV7_IsAvailable = Windows.Foundation.Metadata.ApiInformation.IsApiContractPresent(nameof(Windows.Foundation.UniversalApiContract), 7); - UniversalApiContractV6_IsAvailable = Windows.Foundation.Metadata.ApiInformation.IsApiContractPresent(nameof(Windows.Foundation.UniversalApiContract), 6); - UniversalApiContractV5_IsAvailable = Windows.Foundation.Metadata.ApiInformation.IsApiContractPresent(nameof(Windows.Foundation.UniversalApiContract), 5); - UniversalApiContractV4_IsAvailable = Windows.Foundation.Metadata.ApiInformation.IsApiContractPresent(nameof(Windows.Foundation.UniversalApiContract), 4); - UniversalApiContractV3_IsAvailable = Windows.Foundation.Metadata.ApiInformation.IsApiContractPresent(nameof(Windows.Foundation.UniversalApiContract), 3); +#if WINDOWS_UWP || (UNITY_WSA && DOTNETWINRT_PRESENT) + return ApiInformation.IsMethodPresent($"{namespaceName}.{className}", methodName); #else - UniversalApiContractV8_IsAvailable = false; - UniversalApiContractV7_IsAvailable = false; - UniversalApiContractV6_IsAvailable = false; - UniversalApiContractV5_IsAvailable = false; - UniversalApiContractV4_IsAvailable = false; - UniversalApiContractV3_IsAvailable = false; -#endif + return false; +#endif // WINDOWS_UWP || (UNITY_WSA && DOTNETWINRT_PRESENT) } /// - /// Is the Universal API Contract v8.0 Available? - /// - public static bool UniversalApiContractV8_IsAvailable { get; private set; } - - /// - /// Is the Universal API Contract v7.0 Available? - /// - public static bool UniversalApiContractV7_IsAvailable { get; private set; } - - /// - /// Is the Universal API Contract v6.0 Available? - /// - public static bool UniversalApiContractV6_IsAvailable { get; private set; } - - /// - /// Is the Universal API Contract v5.0 Available? - /// - public static bool UniversalApiContractV5_IsAvailable { get; private set; } - - /// - /// Is the Universal API Contract v4.0 Available? + /// Checks to see if the requested property is present on the current platform. /// - public static bool UniversalApiContractV4_IsAvailable { get; private set; } + /// The namespace (ex: "Windows.UI.Input.Spatial") containing the class. + /// The name of the class containing the method (ex: "SpatialPointerPose"). + /// The name of the method (ex: "Eyes"). + /// True if the property is available and can be called. Otherwise, false. + public static bool IsPropertyAvailable( + string namespaceName, + string className, + string propertyName) + { +#if WINDOWS_UWP || (UNITY_WSA && DOTNETWINRT_PRESENT) + return ApiInformation.IsPropertyPresent($"{namespaceName}.{className}", propertyName); +#else + return false; +#endif // WINDOWS_UWP || (UNITY_WSA && DOTNETWINRT_PRESENT) + } /// - /// Is the Universal API Contract v3.0 Available? + /// Checks to see if the requested type is present on the current platform. /// - public static bool UniversalApiContractV3_IsAvailable { get; private set; } + /// The namespace (ex: "Windows.UI.Input.Spatial") containing the class. + /// The name of the class containing the method (ex: "SpatialPointerPose"). + /// True if the type is available and can be called. Otherwise, false. + public static bool IsTypeAvailable( + string namespaceName, + string typeName) + { +#if WINDOWS_UWP || (UNITY_WSA && DOTNETWINRT_PRESENT) + return ApiInformation.IsTypePresent($"{namespaceName}.{typeName}"); +#else + return false; +#endif // UNITY_WSA && WINDOWS_UWP || (UNITY_WSA && DOTNETWINRT_PRESENT) + } } -} +} \ No newline at end of file From 304dd318efd34c070f6a7bbf2725e05b08aed3b3 Mon Sep 17 00:00:00 2001 From: Dino Fejzagic Date: Mon, 3 Aug 2020 22:13:49 +0200 Subject: [PATCH 57/62] Fix joint-root offset calculation --- .../WindowsMixedRealityHandDataConverter.cs | 22 +++++++------------ 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Runtime/Utilities/WindowsMixedRealityHandDataConverter.cs b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Runtime/Utilities/WindowsMixedRealityHandDataConverter.cs index ca012fa..9a5e179 100644 --- a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Runtime/Utilities/WindowsMixedRealityHandDataConverter.cs +++ b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Runtime/Utilities/WindowsMixedRealityHandDataConverter.cs @@ -163,13 +163,17 @@ private MixedRealityPose GetJointPose(JointPose jointPose, MixedRealityPose hand // put the controller pose into world space. We also want all joint poses to be // relative to the hand's root pose, so we account for that as well. var playspaceTransform = MixedRealityToolkit.CameraSystem.MainCameraRig.PlayspaceTransform; + jointPosition = playspaceTransform.InverseTransformPoint(playspaceTransform.position + playspaceTransform.rotation * jointPosition); + jointRotation = Quaternion.Inverse(playspaceTransform.rotation) * playspaceTransform.rotation * jointRotation; + + // To camera space var cameraTransform = MixedRealityToolkit.CameraSystem != null ? MixedRealityToolkit.CameraSystem.MainCameraRig.PlayerCamera.transform : CameraCache.Main.transform; - jointPosition = playspaceTransform.TransformPoint(jointPosition) - handRootPose.Position; - //jointRotation = playspaceTransform.rotation * jointRotation; - //Quaternion.Inverse(handRootPose.Rotation) * + // To hand root space + jointPosition -= handRootPose.Position; + //jointRotation = cameraTransform.rotation * jointRotation; return new MixedRealityPose(jointPosition, jointRotation); } @@ -184,21 +188,11 @@ private MixedRealityPose GetHandRootPose(JointPose[] platformJointPoses) // For WMR we use the wrist pose as the hand root pose. var wristPose = platformJointPoses[(int)HandJointKind.Wrist]; - var playspaceTransform = MixedRealityToolkit.CameraSystem.MainCameraRig.PlayspaceTransform; - var cameraTransform = MixedRealityToolkit.CameraSystem != null - ? MixedRealityToolkit.CameraSystem.MainCameraRig.PlayerCamera.transform - : CameraCache.Main.transform; - // Convert to playspace. + var playspaceTransform = MixedRealityToolkit.CameraSystem.MainCameraRig.PlayspaceTransform; var rootPosition = playspaceTransform.InverseTransformPoint(playspaceTransform.position + playspaceTransform.rotation * wristPose.Position.ToUnity()); var rootRotation = Quaternion.Inverse(playspaceTransform.rotation) * playspaceTransform.rotation * wristPose.Orientation.ToUnity(); - // Transform to camera space. - Debug.Log($"Camera: {cameraTransform.localPosition}"); - Debug.Log($"Hand Before: {rootPosition}"); - rootPosition.y += cameraTransform.position.y; - Debug.Log($"Hand After: {rootPosition}"); - return new MixedRealityPose(rootPosition, rootRotation); } From a9cc76673a4ed97e77eb2bd46ce53461bac8ba13 Mon Sep 17 00:00:00 2001 From: Dino Fejzagic Date: Fri, 18 Sep 2020 19:05:13 +0200 Subject: [PATCH 58/62] Finally fix freaking joint conversion --- .../WindowsMixedRealityHandDataConverter.cs | 112 +++++++++++++----- 1 file changed, 84 insertions(+), 28 deletions(-) diff --git a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Runtime/Utilities/WindowsMixedRealityHandDataConverter.cs b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Runtime/Utilities/WindowsMixedRealityHandDataConverter.cs index 9a5e179..ff30373 100644 --- a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Runtime/Utilities/WindowsMixedRealityHandDataConverter.cs +++ b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Runtime/Utilities/WindowsMixedRealityHandDataConverter.cs @@ -2,7 +2,6 @@ // Licensed under the MIT License. See LICENSE in the project root for license information. using XRTK.Definitions.Controllers.Hands; -using XRTK.Definitions.Utilities; #if WINDOWS_UWP @@ -15,6 +14,7 @@ using XRTK.WindowsMixedReality.Extensions; using XRTK.Extensions; using XRTK.Definitions.Devices; +using XRTK.Definitions.Utilities; using XRTK.Utilities; #endif // WINDOWS_UWP @@ -28,6 +28,20 @@ public sealed class WindowsMixedRealityHandDataConverter { #if WINDOWS_UWP + /// + /// Destructor. + /// + ~WindowsMixedRealityHandDataConverter() + { + if (!conversionProxyRootTransform.IsNull()) + { + conversionProxyTransforms.Clear(); + conversionProxyRootTransform.Destroy(); + } + } + + private Transform conversionProxyRootTransform; + private readonly Dictionary conversionProxyTransforms = new Dictionary(); private readonly Dictionary handMeshObservers = new Dictionary(); private readonly MixedRealityPose[] jointPoses = new MixedRealityPose[HandData.JointCount]; @@ -96,8 +110,8 @@ public bool TryGetHandData(SpatialInteractionSourceState spatialInteractionSourc // and other data needed for updating the hand controller's state. if (handData.TrackingState == TrackingState.Tracked) { - handData.RootPose = GetHandRootPose(platformJointPoses); - handData.Joints = GetJointPoses(platformJointPoses, handData.RootPose); + handData.RootPose = GetHandRootPose(spatialInteractionSourceState.Source.Handedness, platformJointPoses); + handData.Joints = GetJointPoses(spatialInteractionSourceState.Source.Handedness, platformJointPoses, handData.RootPose); if (includeMeshData && TryGetUpdatedHandMeshData(spatialInteractionSourceState, handPose, out HandMeshData data)) { @@ -134,15 +148,16 @@ public bool TryGetHandData(SpatialInteractionSourceState spatialInteractionSourc /// /// Gets updated joint poses for all s. /// + /// Handedness of the hand the joints belong to. /// Joint poses retrieved from the platform. /// The hand's root pose. /// Joint poses in order. - private MixedRealityPose[] GetJointPoses(JointPose[] platformJointPoses, MixedRealityPose handRootPose) + private MixedRealityPose[] GetJointPoses(SpatialInteractionSourceHandedness handedness, JointPose[] platformJointPoses, MixedRealityPose handRootPose) { for (int i = 0; i < platformJointPoses.Length; i++) { var handJoint = jointIndices[i].ToTrackedHandJoint(); - jointPoses[(int)handJoint] = GetJointPose(platformJointPoses[i], handRootPose); + jointPoses[(int)handJoint] = GetJointPose(handedness, handJoint, handRootPose, platformJointPoses[i]); } return jointPoses; @@ -151,49 +166,51 @@ private MixedRealityPose[] GetJointPoses(JointPose[] platformJointPoses, MixedRe /// /// Gets a single joint's pose relative to the hand root pose. /// + /// Handedness of the hand. + /// The ID of the joint to convert pose for. /// Joint pose data retrieved from the platform. - /// The hand's root pose. /// Converted joint pose in hand space. - private MixedRealityPose GetJointPose(JointPose jointPose, MixedRealityPose handRootPose) + private MixedRealityPose GetJointPose(SpatialInteractionSourceHandedness handedness, TrackedHandJoint trackedHandJoint, MixedRealityPose handRootPose, JointPose jointPose) { - var jointPosition = jointPose.Position.ToUnity(); - var jointRotation = jointPose.Orientation.ToUnity(); - - // We want the controller to follow the Playspace, so fold in the playspace transform here to - // put the controller pose into world space. We also want all joint poses to be - // relative to the hand's root pose, so we account for that as well. + var jointTransform = GetProxyTransform(handedness, trackedHandJoint); var playspaceTransform = MixedRealityToolkit.CameraSystem.MainCameraRig.PlayspaceTransform; - jointPosition = playspaceTransform.InverseTransformPoint(playspaceTransform.position + playspaceTransform.rotation * jointPosition); - jointRotation = Quaternion.Inverse(playspaceTransform.rotation) * playspaceTransform.rotation * jointRotation; - // To camera space - var cameraTransform = MixedRealityToolkit.CameraSystem != null - ? MixedRealityToolkit.CameraSystem.MainCameraRig.PlayerCamera.transform - : CameraCache.Main.transform; - - // To hand root space - jointPosition -= handRootPose.Position; - //jointRotation = cameraTransform.rotation * jointRotation; + if (trackedHandJoint == TrackedHandJoint.Wrist) + { + jointTransform.localPosition = handRootPose.Position; + jointTransform.localRotation = handRootPose.Rotation; + } + else + { + jointTransform.parent = playspaceTransform; + jointTransform.localPosition = playspaceTransform.InverseTransformPoint(playspaceTransform.position + playspaceTransform.rotation * jointPose.Position.ToUnity()); + jointTransform.localRotation = Quaternion.Inverse(playspaceTransform.rotation) * playspaceTransform.rotation * jointPose.Orientation.ToUnity(); + jointTransform.parent = conversionProxyRootTransform; + } - return new MixedRealityPose(jointPosition, jointRotation); + return new MixedRealityPose( + conversionProxyRootTransform.InverseTransformPoint(jointTransform.position), + Quaternion.Inverse(conversionProxyRootTransform.rotation) * jointTransform.rotation); } /// /// Gets the hand's root pose. /// + /// Handedness of the hand. /// Joint poses retrieved from the platform. /// The hands value. - private MixedRealityPose GetHandRootPose(JointPose[] platformJointPoses) + private MixedRealityPose GetHandRootPose(SpatialInteractionSourceHandedness handedness, JointPose[] platformJointPoses) { // For WMR we use the wrist pose as the hand root pose. var wristPose = platformJointPoses[(int)HandJointKind.Wrist]; + var wristProxyTransform = GetProxyTransform(handedness, TrackedHandJoint.Wrist); // Convert to playspace. var playspaceTransform = MixedRealityToolkit.CameraSystem.MainCameraRig.PlayspaceTransform; - var rootPosition = playspaceTransform.InverseTransformPoint(playspaceTransform.position + playspaceTransform.rotation * wristPose.Position.ToUnity()); - var rootRotation = Quaternion.Inverse(playspaceTransform.rotation) * playspaceTransform.rotation * wristPose.Orientation.ToUnity(); + wristProxyTransform.position = playspaceTransform.InverseTransformPoint(playspaceTransform.position + playspaceTransform.rotation * wristPose.Position.ToUnity()); + wristProxyTransform.rotation = Quaternion.Inverse(playspaceTransform.rotation) * playspaceTransform.rotation * wristPose.Orientation.ToUnity(); - return new MixedRealityPose(rootPosition, rootRotation); + return new MixedRealityPose(wristProxyTransform.position, wristProxyTransform.rotation); } /// @@ -329,6 +346,45 @@ private bool HasRequestedHandMeshObserver(SpatialInteractionSourceHandedness han hasRequestedHandMeshObserverLeftHand : handedness == SpatialInteractionSourceHandedness.Right && hasRequestedHandMeshObserverRightHand; + /// + /// The oculus APIs return joint poses relative to their parent joint unlike + /// other platforms where joint poses are relative to the hand root. To convert + /// the joint-->parent-joint relation to joint-->hand-root relations proxy s + /// are used. The proxies are parented to their respective parent . + /// That way we can make use of Unity APIs to translate coordinate spaces. + /// + /// Handedness of the hand the proxy belongs to. + /// The joint ID to lookup the proxy for. + /// The proxy . + private Transform GetProxyTransform(SpatialInteractionSourceHandedness handedness, TrackedHandJoint handJointKind) + { + if (conversionProxyRootTransform.IsNull()) + { + conversionProxyRootTransform = new GameObject("WMR Hand Conversion Proxy").transform; + conversionProxyRootTransform.transform.SetParent(MixedRealityToolkit.CameraSystem.MainCameraRig.PlayspaceTransform, false); + conversionProxyRootTransform.gameObject.SetActive(false); + } + + // Depending on the handedness we are currently working on, we need to rotate the conversion root. + //conversionProxyRootTransform.localRotation = Quaternion.Euler(0f, handedness == SpatialInteractionSourceHandedness.Right ? 180f : 0f, 0f); + + if (handJointKind == TrackedHandJoint.Wrist) + { + return conversionProxyRootTransform; + } + + if (conversionProxyTransforms.ContainsKey(handJointKind)) + { + return conversionProxyTransforms[handJointKind]; + } + + var transform = new GameObject($"WMR Hand {handJointKind} Proxy").transform; + transform.SetParent(MixedRealityToolkit.CameraSystem.MainCameraRig.PlayspaceTransform, false); + conversionProxyTransforms.Add(handJointKind, transform); + + return transform; + } + #endif // WINDOWS_UWP } } \ No newline at end of file From 7fbd5eb0eb6632c424c00c11511be30d3b196950 Mon Sep 17 00:00:00 2001 From: Dino Fejzagic Date: Fri, 18 Sep 2020 19:14:38 +0200 Subject: [PATCH 59/62] Cleanup code --- .../WindowsMixedRealityHandDataConverter.cs | 58 +++++++------------ 1 file changed, 21 insertions(+), 37 deletions(-) diff --git a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Runtime/Utilities/WindowsMixedRealityHandDataConverter.cs b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Runtime/Utilities/WindowsMixedRealityHandDataConverter.cs index ff30373..36ec447 100644 --- a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Runtime/Utilities/WindowsMixedRealityHandDataConverter.cs +++ b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Runtime/Utilities/WindowsMixedRealityHandDataConverter.cs @@ -15,7 +15,6 @@ using XRTK.Extensions; using XRTK.Definitions.Devices; using XRTK.Definitions.Utilities; -using XRTK.Utilities; #endif // WINDOWS_UWP @@ -110,8 +109,8 @@ public bool TryGetHandData(SpatialInteractionSourceState spatialInteractionSourc // and other data needed for updating the hand controller's state. if (handData.TrackingState == TrackingState.Tracked) { - handData.RootPose = GetHandRootPose(spatialInteractionSourceState.Source.Handedness, platformJointPoses); - handData.Joints = GetJointPoses(spatialInteractionSourceState.Source.Handedness, platformJointPoses, handData.RootPose); + handData.RootPose = GetHandRootPose(platformJointPoses); + handData.Joints = GetJointPoses(platformJointPoses, handData.RootPose); if (includeMeshData && TryGetUpdatedHandMeshData(spatialInteractionSourceState, handPose, out HandMeshData data)) { @@ -146,33 +145,32 @@ public bool TryGetHandData(SpatialInteractionSourceState spatialInteractionSourc } /// - /// Gets updated joint poses for all s. + /// Gets updated joint s for all s of a hand. /// - /// Handedness of the hand the joints belong to. - /// Joint poses retrieved from the platform. - /// The hand's root pose. - /// Joint poses in order. - private MixedRealityPose[] GetJointPoses(SpatialInteractionSourceHandedness handedness, JointPose[] platformJointPoses, MixedRealityPose handRootPose) + /// s retrieved from the platform. + /// The hand's root . + /// Joint s in ascending order. + private MixedRealityPose[] GetJointPoses(JointPose[] platformJointPoses, MixedRealityPose handRootPose) { for (int i = 0; i < platformJointPoses.Length; i++) { var handJoint = jointIndices[i].ToTrackedHandJoint(); - jointPoses[(int)handJoint] = GetJointPose(handedness, handJoint, handRootPose, platformJointPoses[i]); + jointPoses[(int)handJoint] = GetJointPose(handJoint, handRootPose, platformJointPoses[i]); } return jointPoses; } /// - /// Gets a single joint's pose relative to the hand root pose. + /// Gets a single joint's relative to the hand root pose. /// - /// Handedness of the hand. - /// The ID of the joint to convert pose for. - /// Joint pose data retrieved from the platform. - /// Converted joint pose in hand space. - private MixedRealityPose GetJointPose(SpatialInteractionSourceHandedness handedness, TrackedHandJoint trackedHandJoint, MixedRealityPose handRootPose, JointPose jointPose) + /// The Id for the joint to get a for. + /// The hand's root . Joint poses are always relative to the root pose. + /// retrieved from the platform. + /// Joint relative to the hand's root pose. + private MixedRealityPose GetJointPose(TrackedHandJoint trackedHandJoint, MixedRealityPose handRootPose, JointPose jointPose) { - var jointTransform = GetProxyTransform(handedness, trackedHandJoint); + var jointTransform = GetProxyTransform(trackedHandJoint); var playspaceTransform = MixedRealityToolkit.CameraSystem.MainCameraRig.PlayspaceTransform; if (trackedHandJoint == TrackedHandJoint.Wrist) @@ -194,16 +192,15 @@ private MixedRealityPose GetJointPose(SpatialInteractionSourceHandedness handedn } /// - /// Gets the hand's root pose. + /// Gets the hand's root in playspace. /// - /// Handedness of the hand. - /// Joint poses retrieved from the platform. - /// The hands value. - private MixedRealityPose GetHandRootPose(SpatialInteractionSourceHandedness handedness, JointPose[] platformJointPoses) + /// s retrieved from the platform. + /// The hands . + private MixedRealityPose GetHandRootPose(JointPose[] platformJointPoses) { // For WMR we use the wrist pose as the hand root pose. var wristPose = platformJointPoses[(int)HandJointKind.Wrist]; - var wristProxyTransform = GetProxyTransform(handedness, TrackedHandJoint.Wrist); + var wristProxyTransform = GetProxyTransform(TrackedHandJoint.Wrist); // Convert to playspace. var playspaceTransform = MixedRealityToolkit.CameraSystem.MainCameraRig.PlayspaceTransform; @@ -346,17 +343,7 @@ private bool HasRequestedHandMeshObserver(SpatialInteractionSourceHandedness han hasRequestedHandMeshObserverLeftHand : handedness == SpatialInteractionSourceHandedness.Right && hasRequestedHandMeshObserverRightHand; - /// - /// The oculus APIs return joint poses relative to their parent joint unlike - /// other platforms where joint poses are relative to the hand root. To convert - /// the joint-->parent-joint relation to joint-->hand-root relations proxy s - /// are used. The proxies are parented to their respective parent . - /// That way we can make use of Unity APIs to translate coordinate spaces. - /// - /// Handedness of the hand the proxy belongs to. - /// The joint ID to lookup the proxy for. - /// The proxy . - private Transform GetProxyTransform(SpatialInteractionSourceHandedness handedness, TrackedHandJoint handJointKind) + private Transform GetProxyTransform(TrackedHandJoint handJointKind) { if (conversionProxyRootTransform.IsNull()) { @@ -365,9 +352,6 @@ private Transform GetProxyTransform(SpatialInteractionSourceHandedness handednes conversionProxyRootTransform.gameObject.SetActive(false); } - // Depending on the handedness we are currently working on, we need to rotate the conversion root. - //conversionProxyRootTransform.localRotation = Quaternion.Euler(0f, handedness == SpatialInteractionSourceHandedness.Right ? 180f : 0f, 0f); - if (handJointKind == TrackedHandJoint.Wrist) { return conversionProxyRootTransform; From e7ebf6562af02bd04effc0b1708c27c06cd608d0 Mon Sep 17 00:00:00 2001 From: Dino Fejzagic Date: Fri, 18 Sep 2020 19:15:03 +0200 Subject: [PATCH 60/62] Commit new controller GUIDs --- .../Contollers/WindowsMixedRealityController.meta | 8 ++++++++ .../Contollers/WindowsMixedRealityController/Left.meta | 2 +- .../Left/GripPressProfile.asset.meta | 2 +- .../Left/InvertDualAxisProcessor.asset.meta | 2 +- .../Left/MenuPressProfile.asset.meta | 2 +- .../Left/SpatialGripProfile.asset.meta | 2 +- .../Left/SpatialPointerProfile.asset.meta | 2 +- .../Left/ThumbstickClickProfile.asset.meta | 2 +- .../Left/ThumbstickPositionProfile.asset.meta | 2 +- .../Left/TouchpadPositionProfile.asset.meta | 2 +- .../Left/TouchpadPressProfile.asset.meta | 2 +- .../Left/TouchpadTouchProfile.asset.meta | 2 +- .../Left/TriggerPositionProfile.asset.meta | 2 +- .../Left/TriggerPress(Select)Profile.asset.meta | 2 +- .../Left/TriggerTouchProfile.asset.meta | 2 +- .../Left/TriggerTouchedProfile.asset.meta | 2 +- .../Contollers/WindowsMixedRealityController/Right.meta | 2 +- .../Right/GripPressProfile.asset.meta | 2 +- .../Right/InvertDualAxisProcessor.asset.meta | 2 +- .../Right/MenuPressProfile.asset.meta | 2 +- .../Right/SpatialGripProfile.asset.meta | 2 +- .../Right/SpatialPointerProfile.asset.meta | 2 +- .../Right/ThumbstickClickProfile.asset.meta | 2 +- .../Right/ThumbstickPositionProfile.asset.meta | 2 +- .../Right/TouchpadPositionProfile.asset.meta | 2 +- .../Right/TouchpadPressProfile.asset.meta | 2 +- .../Right/TouchpadTouchProfile.asset.meta | 2 +- .../Right/TriggerPositionProfile.asset.meta | 2 +- .../Right/TriggerPress(Select)Profile.asset.meta | 2 +- .../Right/TriggerTouchProfile.asset.meta | 2 +- .../Right/TriggerTouchedProfile.asset.meta | 2 +- 31 files changed, 38 insertions(+), 30 deletions(-) create mode 100644 XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Profiles~/Contollers/WindowsMixedRealityController.meta diff --git a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Profiles~/Contollers/WindowsMixedRealityController.meta b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Profiles~/Contollers/WindowsMixedRealityController.meta new file mode 100644 index 0000000..7fe0835 --- /dev/null +++ b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Profiles~/Contollers/WindowsMixedRealityController.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 94af4f07a9a69dc4ba11073dc9267ed9 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Profiles~/Contollers/WindowsMixedRealityController/Left.meta b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Profiles~/Contollers/WindowsMixedRealityController/Left.meta index 968aa69..b8445d5 100644 --- a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Profiles~/Contollers/WindowsMixedRealityController/Left.meta +++ b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Profiles~/Contollers/WindowsMixedRealityController/Left.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: e5d2741f23dcb3c49b091a09fc40dbc0 +guid: e556001044e780a43b929eb51ae23944 folderAsset: yes DefaultImporter: externalObjects: {} diff --git a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Profiles~/Contollers/WindowsMixedRealityController/Left/GripPressProfile.asset.meta b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Profiles~/Contollers/WindowsMixedRealityController/Left/GripPressProfile.asset.meta index da3580c..d4a3106 100644 --- a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Profiles~/Contollers/WindowsMixedRealityController/Left/GripPressProfile.asset.meta +++ b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Profiles~/Contollers/WindowsMixedRealityController/Left/GripPressProfile.asset.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 7e4ecf81e5712754c8d245537978d758 +guid: 4cde54435873b4649b69d7f5c77e5fe0 NativeFormatImporter: externalObjects: {} mainObjectFileID: 11400000 diff --git a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Profiles~/Contollers/WindowsMixedRealityController/Left/InvertDualAxisProcessor.asset.meta b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Profiles~/Contollers/WindowsMixedRealityController/Left/InvertDualAxisProcessor.asset.meta index d91c46d..5821931 100644 --- a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Profiles~/Contollers/WindowsMixedRealityController/Left/InvertDualAxisProcessor.asset.meta +++ b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Profiles~/Contollers/WindowsMixedRealityController/Left/InvertDualAxisProcessor.asset.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 2158a760049510f429c34a8e131a1e69 +guid: 31f74fdbae4feb14fa28be1dd9378cef NativeFormatImporter: externalObjects: {} mainObjectFileID: 11400000 diff --git a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Profiles~/Contollers/WindowsMixedRealityController/Left/MenuPressProfile.asset.meta b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Profiles~/Contollers/WindowsMixedRealityController/Left/MenuPressProfile.asset.meta index dff31d5..f263500 100644 --- a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Profiles~/Contollers/WindowsMixedRealityController/Left/MenuPressProfile.asset.meta +++ b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Profiles~/Contollers/WindowsMixedRealityController/Left/MenuPressProfile.asset.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 8374fc38e78c9174f812db35adecc959 +guid: 939aa56150ed8a348b53e8636d4edf7a NativeFormatImporter: externalObjects: {} mainObjectFileID: 11400000 diff --git a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Profiles~/Contollers/WindowsMixedRealityController/Left/SpatialGripProfile.asset.meta b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Profiles~/Contollers/WindowsMixedRealityController/Left/SpatialGripProfile.asset.meta index be86160..9863b4a 100644 --- a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Profiles~/Contollers/WindowsMixedRealityController/Left/SpatialGripProfile.asset.meta +++ b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Profiles~/Contollers/WindowsMixedRealityController/Left/SpatialGripProfile.asset.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: b10b88729da78e243b99b30e15b3f810 +guid: bbf83b0f6936bdf40b55fc01d191c970 NativeFormatImporter: externalObjects: {} mainObjectFileID: 11400000 diff --git a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Profiles~/Contollers/WindowsMixedRealityController/Left/SpatialPointerProfile.asset.meta b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Profiles~/Contollers/WindowsMixedRealityController/Left/SpatialPointerProfile.asset.meta index f349025..d5481f3 100644 --- a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Profiles~/Contollers/WindowsMixedRealityController/Left/SpatialPointerProfile.asset.meta +++ b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Profiles~/Contollers/WindowsMixedRealityController/Left/SpatialPointerProfile.asset.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 4eabae8f23a506948894ceab3ed56bed +guid: 669d97502770bc241ac25834fa793d8b NativeFormatImporter: externalObjects: {} mainObjectFileID: 11400000 diff --git a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Profiles~/Contollers/WindowsMixedRealityController/Left/ThumbstickClickProfile.asset.meta b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Profiles~/Contollers/WindowsMixedRealityController/Left/ThumbstickClickProfile.asset.meta index 57842db..e3b3fa1 100644 --- a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Profiles~/Contollers/WindowsMixedRealityController/Left/ThumbstickClickProfile.asset.meta +++ b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Profiles~/Contollers/WindowsMixedRealityController/Left/ThumbstickClickProfile.asset.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: f19cadd37dae8c7449b4bf2a9ec8f262 +guid: 7229007b181ce2c49b64a1cbef700c9c NativeFormatImporter: externalObjects: {} mainObjectFileID: 11400000 diff --git a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Profiles~/Contollers/WindowsMixedRealityController/Left/ThumbstickPositionProfile.asset.meta b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Profiles~/Contollers/WindowsMixedRealityController/Left/ThumbstickPositionProfile.asset.meta index 127a897..1ae96c2 100644 --- a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Profiles~/Contollers/WindowsMixedRealityController/Left/ThumbstickPositionProfile.asset.meta +++ b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Profiles~/Contollers/WindowsMixedRealityController/Left/ThumbstickPositionProfile.asset.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 2394acc9efbc4a649bbc8a4af8279a85 +guid: 55cf4c87b304d984cb995fad4018170d NativeFormatImporter: externalObjects: {} mainObjectFileID: 11400000 diff --git a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Profiles~/Contollers/WindowsMixedRealityController/Left/TouchpadPositionProfile.asset.meta b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Profiles~/Contollers/WindowsMixedRealityController/Left/TouchpadPositionProfile.asset.meta index edd4b68..bdb1e91 100644 --- a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Profiles~/Contollers/WindowsMixedRealityController/Left/TouchpadPositionProfile.asset.meta +++ b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Profiles~/Contollers/WindowsMixedRealityController/Left/TouchpadPositionProfile.asset.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 2e61fbdb1f55b0146a52033f2ebbfbff +guid: 22a2efc24b920ad4cbcbee8b6e65ac66 NativeFormatImporter: externalObjects: {} mainObjectFileID: 11400000 diff --git a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Profiles~/Contollers/WindowsMixedRealityController/Left/TouchpadPressProfile.asset.meta b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Profiles~/Contollers/WindowsMixedRealityController/Left/TouchpadPressProfile.asset.meta index 19883b9..31a4a2a 100644 --- a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Profiles~/Contollers/WindowsMixedRealityController/Left/TouchpadPressProfile.asset.meta +++ b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Profiles~/Contollers/WindowsMixedRealityController/Left/TouchpadPressProfile.asset.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 3070249a19481544a88c8edb12bdb4f1 +guid: 1884d4e0b33e32d42b5731289987b2de NativeFormatImporter: externalObjects: {} mainObjectFileID: 11400000 diff --git a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Profiles~/Contollers/WindowsMixedRealityController/Left/TouchpadTouchProfile.asset.meta b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Profiles~/Contollers/WindowsMixedRealityController/Left/TouchpadTouchProfile.asset.meta index 364823b..8fffb50 100644 --- a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Profiles~/Contollers/WindowsMixedRealityController/Left/TouchpadTouchProfile.asset.meta +++ b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Profiles~/Contollers/WindowsMixedRealityController/Left/TouchpadTouchProfile.asset.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 49266328add1c764e8b882e1e9bb89d4 +guid: e8f950a1a00bbc14e9a42deae23de196 NativeFormatImporter: externalObjects: {} mainObjectFileID: 11400000 diff --git a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Profiles~/Contollers/WindowsMixedRealityController/Left/TriggerPositionProfile.asset.meta b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Profiles~/Contollers/WindowsMixedRealityController/Left/TriggerPositionProfile.asset.meta index 17604e9..7fecbb5 100644 --- a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Profiles~/Contollers/WindowsMixedRealityController/Left/TriggerPositionProfile.asset.meta +++ b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Profiles~/Contollers/WindowsMixedRealityController/Left/TriggerPositionProfile.asset.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: c6849f14c4d742d4e918c4ce1bf2b4b4 +guid: dc9d8c00038c2d84dbea53fc8935af15 NativeFormatImporter: externalObjects: {} mainObjectFileID: 11400000 diff --git a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Profiles~/Contollers/WindowsMixedRealityController/Left/TriggerPress(Select)Profile.asset.meta b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Profiles~/Contollers/WindowsMixedRealityController/Left/TriggerPress(Select)Profile.asset.meta index 353ff1f..482f280 100644 --- a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Profiles~/Contollers/WindowsMixedRealityController/Left/TriggerPress(Select)Profile.asset.meta +++ b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Profiles~/Contollers/WindowsMixedRealityController/Left/TriggerPress(Select)Profile.asset.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: f244c21bf0106a64a903950d2fbd60f9 +guid: d08f6946e2676bb4389eaa9fec6f1267 NativeFormatImporter: externalObjects: {} mainObjectFileID: 11400000 diff --git a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Profiles~/Contollers/WindowsMixedRealityController/Left/TriggerTouchProfile.asset.meta b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Profiles~/Contollers/WindowsMixedRealityController/Left/TriggerTouchProfile.asset.meta index 1e47474..3f0539d 100644 --- a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Profiles~/Contollers/WindowsMixedRealityController/Left/TriggerTouchProfile.asset.meta +++ b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Profiles~/Contollers/WindowsMixedRealityController/Left/TriggerTouchProfile.asset.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: cb57613c9a29a204a9e53a5f084d876b +guid: 9133bba4e3a8d0e42864e49a5f6e3416 NativeFormatImporter: externalObjects: {} mainObjectFileID: 11400000 diff --git a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Profiles~/Contollers/WindowsMixedRealityController/Left/TriggerTouchedProfile.asset.meta b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Profiles~/Contollers/WindowsMixedRealityController/Left/TriggerTouchedProfile.asset.meta index 4dea359..5e35506 100644 --- a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Profiles~/Contollers/WindowsMixedRealityController/Left/TriggerTouchedProfile.asset.meta +++ b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Profiles~/Contollers/WindowsMixedRealityController/Left/TriggerTouchedProfile.asset.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 20ebd784cd7d33c4c8e046ad905f8fd6 +guid: 4740f843e007bc244aa4ee60fe62e49d NativeFormatImporter: externalObjects: {} mainObjectFileID: 11400000 diff --git a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Profiles~/Contollers/WindowsMixedRealityController/Right.meta b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Profiles~/Contollers/WindowsMixedRealityController/Right.meta index eac945f..4a2ef50 100644 --- a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Profiles~/Contollers/WindowsMixedRealityController/Right.meta +++ b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Profiles~/Contollers/WindowsMixedRealityController/Right.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 7b6c25febbe774f4c808d5b48d138001 +guid: 0bfd33d5f032e0d4da10d7a85399006c folderAsset: yes DefaultImporter: externalObjects: {} diff --git a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Profiles~/Contollers/WindowsMixedRealityController/Right/GripPressProfile.asset.meta b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Profiles~/Contollers/WindowsMixedRealityController/Right/GripPressProfile.asset.meta index 40391c0..8d6a661 100644 --- a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Profiles~/Contollers/WindowsMixedRealityController/Right/GripPressProfile.asset.meta +++ b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Profiles~/Contollers/WindowsMixedRealityController/Right/GripPressProfile.asset.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 57cf8e3c0f0470e418fee2c4919c460a +guid: a74a73b1c5abdb049a73a9b44b0b2e98 NativeFormatImporter: externalObjects: {} mainObjectFileID: 11400000 diff --git a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Profiles~/Contollers/WindowsMixedRealityController/Right/InvertDualAxisProcessor.asset.meta b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Profiles~/Contollers/WindowsMixedRealityController/Right/InvertDualAxisProcessor.asset.meta index 15898eb..4a2a13d 100644 --- a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Profiles~/Contollers/WindowsMixedRealityController/Right/InvertDualAxisProcessor.asset.meta +++ b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Profiles~/Contollers/WindowsMixedRealityController/Right/InvertDualAxisProcessor.asset.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 9c40de59f43b08245b4e74f7dc6b14bc +guid: 936774fa4f963834a8f2417be8b8d9c1 NativeFormatImporter: externalObjects: {} mainObjectFileID: 11400000 diff --git a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Profiles~/Contollers/WindowsMixedRealityController/Right/MenuPressProfile.asset.meta b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Profiles~/Contollers/WindowsMixedRealityController/Right/MenuPressProfile.asset.meta index 59bcb22..5ff34eb 100644 --- a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Profiles~/Contollers/WindowsMixedRealityController/Right/MenuPressProfile.asset.meta +++ b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Profiles~/Contollers/WindowsMixedRealityController/Right/MenuPressProfile.asset.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 4c6a577ebcde56343807fd5d3c50dd77 +guid: 6b662c7eddb36704581ea73260d9ed0c NativeFormatImporter: externalObjects: {} mainObjectFileID: 11400000 diff --git a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Profiles~/Contollers/WindowsMixedRealityController/Right/SpatialGripProfile.asset.meta b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Profiles~/Contollers/WindowsMixedRealityController/Right/SpatialGripProfile.asset.meta index 746b9ba..0494599 100644 --- a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Profiles~/Contollers/WindowsMixedRealityController/Right/SpatialGripProfile.asset.meta +++ b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Profiles~/Contollers/WindowsMixedRealityController/Right/SpatialGripProfile.asset.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: ee806d7f585c7c34295c77499684b046 +guid: ef9ee042babf1684cbaf525774f40d9d NativeFormatImporter: externalObjects: {} mainObjectFileID: 11400000 diff --git a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Profiles~/Contollers/WindowsMixedRealityController/Right/SpatialPointerProfile.asset.meta b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Profiles~/Contollers/WindowsMixedRealityController/Right/SpatialPointerProfile.asset.meta index e394795..1dea9ef 100644 --- a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Profiles~/Contollers/WindowsMixedRealityController/Right/SpatialPointerProfile.asset.meta +++ b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Profiles~/Contollers/WindowsMixedRealityController/Right/SpatialPointerProfile.asset.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 2383d0f88b769e842b742f8a8b099c6d +guid: eb4fddd7eb87b124f841b007e0f01ae5 NativeFormatImporter: externalObjects: {} mainObjectFileID: 11400000 diff --git a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Profiles~/Contollers/WindowsMixedRealityController/Right/ThumbstickClickProfile.asset.meta b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Profiles~/Contollers/WindowsMixedRealityController/Right/ThumbstickClickProfile.asset.meta index f0bf02e..b4ddc09 100644 --- a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Profiles~/Contollers/WindowsMixedRealityController/Right/ThumbstickClickProfile.asset.meta +++ b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Profiles~/Contollers/WindowsMixedRealityController/Right/ThumbstickClickProfile.asset.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 72cf9cede81a0d6469e667e7f9f4d627 +guid: f6de46af1ba79f241847d39062c2bb6e NativeFormatImporter: externalObjects: {} mainObjectFileID: 11400000 diff --git a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Profiles~/Contollers/WindowsMixedRealityController/Right/ThumbstickPositionProfile.asset.meta b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Profiles~/Contollers/WindowsMixedRealityController/Right/ThumbstickPositionProfile.asset.meta index 6044ce2..2d9d545 100644 --- a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Profiles~/Contollers/WindowsMixedRealityController/Right/ThumbstickPositionProfile.asset.meta +++ b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Profiles~/Contollers/WindowsMixedRealityController/Right/ThumbstickPositionProfile.asset.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 1b5e85d560958ac4f8c261cc0700fe68 +guid: 7ee0442e6d1cead47a8e89301c4d343f NativeFormatImporter: externalObjects: {} mainObjectFileID: 11400000 diff --git a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Profiles~/Contollers/WindowsMixedRealityController/Right/TouchpadPositionProfile.asset.meta b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Profiles~/Contollers/WindowsMixedRealityController/Right/TouchpadPositionProfile.asset.meta index 9c240ac..67fdb62 100644 --- a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Profiles~/Contollers/WindowsMixedRealityController/Right/TouchpadPositionProfile.asset.meta +++ b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Profiles~/Contollers/WindowsMixedRealityController/Right/TouchpadPositionProfile.asset.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 02554fe515e77724899f40f0f966b7f0 +guid: 171ce182a979c7f4896da13d78d014fe NativeFormatImporter: externalObjects: {} mainObjectFileID: 11400000 diff --git a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Profiles~/Contollers/WindowsMixedRealityController/Right/TouchpadPressProfile.asset.meta b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Profiles~/Contollers/WindowsMixedRealityController/Right/TouchpadPressProfile.asset.meta index afe0997..58609c7 100644 --- a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Profiles~/Contollers/WindowsMixedRealityController/Right/TouchpadPressProfile.asset.meta +++ b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Profiles~/Contollers/WindowsMixedRealityController/Right/TouchpadPressProfile.asset.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: f5364f5a5cacf724eb351a12b08175fc +guid: 61ea3544727361e418900f4806d00403 NativeFormatImporter: externalObjects: {} mainObjectFileID: 11400000 diff --git a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Profiles~/Contollers/WindowsMixedRealityController/Right/TouchpadTouchProfile.asset.meta b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Profiles~/Contollers/WindowsMixedRealityController/Right/TouchpadTouchProfile.asset.meta index 3f9c4ef..ebbf6f6 100644 --- a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Profiles~/Contollers/WindowsMixedRealityController/Right/TouchpadTouchProfile.asset.meta +++ b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Profiles~/Contollers/WindowsMixedRealityController/Right/TouchpadTouchProfile.asset.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 4719f6b4b88c2f24cb711ef28f16b7ee +guid: e2dbd828dced4f14eba72f7870e73bba NativeFormatImporter: externalObjects: {} mainObjectFileID: 11400000 diff --git a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Profiles~/Contollers/WindowsMixedRealityController/Right/TriggerPositionProfile.asset.meta b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Profiles~/Contollers/WindowsMixedRealityController/Right/TriggerPositionProfile.asset.meta index 36b380d..b94619a 100644 --- a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Profiles~/Contollers/WindowsMixedRealityController/Right/TriggerPositionProfile.asset.meta +++ b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Profiles~/Contollers/WindowsMixedRealityController/Right/TriggerPositionProfile.asset.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 38db213a242a3864dbb2410d676c2324 +guid: 9ebeb5e994087954bb05781c9c477f3e NativeFormatImporter: externalObjects: {} mainObjectFileID: 11400000 diff --git a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Profiles~/Contollers/WindowsMixedRealityController/Right/TriggerPress(Select)Profile.asset.meta b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Profiles~/Contollers/WindowsMixedRealityController/Right/TriggerPress(Select)Profile.asset.meta index bdfd1ca..75dc746 100644 --- a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Profiles~/Contollers/WindowsMixedRealityController/Right/TriggerPress(Select)Profile.asset.meta +++ b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Profiles~/Contollers/WindowsMixedRealityController/Right/TriggerPress(Select)Profile.asset.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: be34017cfd537b94cbeab39839f72881 +guid: 0f2de0b794676bd4c9615ec012cd4457 NativeFormatImporter: externalObjects: {} mainObjectFileID: 11400000 diff --git a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Profiles~/Contollers/WindowsMixedRealityController/Right/TriggerTouchProfile.asset.meta b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Profiles~/Contollers/WindowsMixedRealityController/Right/TriggerTouchProfile.asset.meta index 4e8bd41..e6f9996 100644 --- a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Profiles~/Contollers/WindowsMixedRealityController/Right/TriggerTouchProfile.asset.meta +++ b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Profiles~/Contollers/WindowsMixedRealityController/Right/TriggerTouchProfile.asset.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: cba0ece867acec34eb29efc6f74dc7ff +guid: c6ad2eb197ef03f4588c20d33cbb7bc4 NativeFormatImporter: externalObjects: {} mainObjectFileID: 11400000 diff --git a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Profiles~/Contollers/WindowsMixedRealityController/Right/TriggerTouchedProfile.asset.meta b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Profiles~/Contollers/WindowsMixedRealityController/Right/TriggerTouchedProfile.asset.meta index 1d3641f..0149eea 100644 --- a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Profiles~/Contollers/WindowsMixedRealityController/Right/TriggerTouchedProfile.asset.meta +++ b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Profiles~/Contollers/WindowsMixedRealityController/Right/TriggerTouchedProfile.asset.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 6b556181d2b71654486e12acfeaf4c70 +guid: 0d36a94dafc81494c90b9c942153d142 NativeFormatImporter: externalObjects: {} mainObjectFileID: 11400000 From 6f7e9870fd308551d851ad8b40d6d9f94b4da78a Mon Sep 17 00:00:00 2001 From: Dino Fejzagic Date: Sun, 20 Sep 2020 21:18:48 +0200 Subject: [PATCH 61/62] Implement pointer pose override for WMR platform --- ...sMixedRealityHandControllerDataProvider.cs | 5 +++- .../WindowsMixedRealityHandDataConverter.cs | 27 ++++++++++++++++++- 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Runtime/Providers/Controllers/WindowsMixedRealityHandControllerDataProvider.cs b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Runtime/Providers/Controllers/WindowsMixedRealityHandControllerDataProvider.cs index 8f42119..f2c6a65 100644 --- a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Runtime/Providers/Controllers/WindowsMixedRealityHandControllerDataProvider.cs +++ b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Runtime/Providers/Controllers/WindowsMixedRealityHandControllerDataProvider.cs @@ -39,7 +39,10 @@ public WindowsMixedRealityHandControllerDataProvider(string name, uint priority, : base(name, priority, profile, parentService) { handDataProvider = new WindowsMixedRealityHandDataConverter(); - postProcessor = new HandDataPostProcessor(TrackedPoses); + postProcessor = new HandDataPostProcessor(TrackedPoses) + { + PlatformProvidesPointerPose = true + }; } private readonly WindowsMixedRealityHandDataConverter handDataProvider; diff --git a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Runtime/Utilities/WindowsMixedRealityHandDataConverter.cs b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Runtime/Utilities/WindowsMixedRealityHandDataConverter.cs index 36ec447..58c9db2 100644 --- a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Runtime/Utilities/WindowsMixedRealityHandDataConverter.cs +++ b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Runtime/Utilities/WindowsMixedRealityHandDataConverter.cs @@ -111,6 +111,7 @@ public bool TryGetHandData(SpatialInteractionSourceState spatialInteractionSourc { handData.RootPose = GetHandRootPose(platformJointPoses); handData.Joints = GetJointPoses(platformJointPoses, handData.RootPose); + handData.PointerPose = GetPointerPose(spatialInteractionSourceState); if (includeMeshData && TryGetUpdatedHandMeshData(spatialInteractionSourceState, handPose, out HandMeshData data)) { @@ -195,7 +196,7 @@ private MixedRealityPose GetJointPose(TrackedHandJoint trackedHandJoint, MixedRe /// Gets the hand's root in playspace. /// /// s retrieved from the platform. - /// The hands . + /// The hand's . private MixedRealityPose GetHandRootPose(JointPose[] platformJointPoses) { // For WMR we use the wrist pose as the hand root pose. @@ -210,6 +211,30 @@ private MixedRealityPose GetHandRootPose(JointPose[] platformJointPoses) return new MixedRealityPose(wristProxyTransform.position, wristProxyTransform.rotation); } + /// + /// Gets the hand's spatial pointer in playspace. + /// + /// Current snapshot of the hand. + /// The hand's in playspace. + private MixedRealityPose GetPointerPose(SpatialInteractionSourceState spatialInteractionSourceState) + { + var spatialPointerPose = spatialInteractionSourceState.TryGetPointerPose(WindowsMixedRealityUtilities.SpatialCoordinateSystem); + if (spatialPointerPose != null) + { + var interactionSourcePose = spatialPointerPose.TryGetInteractionSourcePose(spatialInteractionSourceState.Source); + if (interactionSourcePose != null) + { + var playspaceTransform = MixedRealityToolkit.CameraSystem.MainCameraRig.PlayspaceTransform; + var pointerPosition = playspaceTransform.InverseTransformPoint(playspaceTransform.position + playspaceTransform.rotation * interactionSourcePose.Position.ToUnity()); + var pointerRotation = Quaternion.Inverse(playspaceTransform.rotation) * playspaceTransform.rotation * interactionSourcePose.Orientation.ToUnity(); + + return new MixedRealityPose(pointerPosition, pointerRotation); + } + } + + return MixedRealityPose.ZeroIdentity; + } + /// /// Attempts to get updated hand mesh data. /// From a248a3ba98fec97bc78528d13241a86754b69dce Mon Sep 17 00:00:00 2001 From: Dino Fejzagic Date: Mon, 21 Sep 2020 20:01:30 +0200 Subject: [PATCH 62/62] Remove DOTNETWINRT_PRESENT usage --- .../Runtime/Utilities/WindowsApiChecker.cs | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Runtime/Utilities/WindowsApiChecker.cs b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Runtime/Utilities/WindowsApiChecker.cs index 44332e2..34b3276 100644 --- a/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Runtime/Utilities/WindowsApiChecker.cs +++ b/XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Runtime/Utilities/WindowsApiChecker.cs @@ -3,8 +3,6 @@ #if WINDOWS_UWP using Windows.Foundation.Metadata; -#elif (UNITY_WSA && DOTNETWINRT_PRESENT) -using Microsoft.Windows.Foundation.Metadata; #endif // WINDOWS_UWP namespace XRTK.WindowsMixedReality.Utilities @@ -28,11 +26,11 @@ public static bool IsMethodAvailable( string className, string methodName) { -#if WINDOWS_UWP || (UNITY_WSA && DOTNETWINRT_PRESENT) +#if WINDOWS_UWP return ApiInformation.IsMethodPresent($"{namespaceName}.{className}", methodName); #else return false; -#endif // WINDOWS_UWP || (UNITY_WSA && DOTNETWINRT_PRESENT) +#endif // WINDOWS_UWP } /// @@ -47,11 +45,11 @@ public static bool IsPropertyAvailable( string className, string propertyName) { -#if WINDOWS_UWP || (UNITY_WSA && DOTNETWINRT_PRESENT) +#if WINDOWS_UWP return ApiInformation.IsPropertyPresent($"{namespaceName}.{className}", propertyName); #else return false; -#endif // WINDOWS_UWP || (UNITY_WSA && DOTNETWINRT_PRESENT) +#endif // WINDOWS_UWP } /// @@ -64,11 +62,11 @@ public static bool IsTypeAvailable( string namespaceName, string typeName) { -#if WINDOWS_UWP || (UNITY_WSA && DOTNETWINRT_PRESENT) +#if WINDOWS_UWP return ApiInformation.IsTypePresent($"{namespaceName}.{typeName}"); #else return false; -#endif // UNITY_WSA && WINDOWS_UWP || (UNITY_WSA && DOTNETWINRT_PRESENT) +#endif // WINDOWS_UWP } } } \ No newline at end of file