Skip to content

Commit c1df30f

Browse files
Merge pull request #2837 from StephenHodgson/vNEXT-ControllerProxyVisualizationProfile
Controller proxy visualization profile
2 parents 467e3e4 + c534c1f commit c1df30f

24 files changed

+697
-296
lines changed

Assets/MixedRealityToolkit-SDK/Features/Input/MixedRealityInputManager.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ public class MixedRealityInputManager : MixedRealityEventManager, IMixedRealityI
3333
/// <inheritdoc />
3434
public HashSet<IMixedRealityInputSource> DetectedInputSources { get; } = new HashSet<IMixedRealityInputSource>();
3535

36+
/// <inheritdoc />
37+
public HashSet<IMixedRealityController> DetectedControllers { get; } = new HashSet<IMixedRealityController>();
38+
3639
/// <inheritdoc />
3740
public IMixedRealityFocusProvider FocusProvider => focusProvider;
3841
private FocusProvider focusProvider;
@@ -495,6 +498,11 @@ public void RaiseSourceDetected(IMixedRealityInputSource source, IMixedRealityCo
495498

496499
DetectedInputSources.Add(source);
497500

501+
if (controller != null)
502+
{
503+
DetectedControllers.Add(controller);
504+
}
505+
498506
// Pass handler through HandleEvent to perform modal/fallback logic
499507
HandleEvent(sourceStateEventData, OnSourceDetectedEventHandler);
500508
}
@@ -516,6 +524,11 @@ public void RaiseSourceLost(IMixedRealityInputSource source, IMixedRealityContro
516524

517525
DetectedInputSources.Remove(source);
518526

527+
if (controller != null)
528+
{
529+
DetectedControllers.Remove(controller);
530+
}
531+
519532
// Pass handler through HandleEvent to perform modal/fallback logic
520533
HandleEvent(sourceStateEventData, OnSourceLostEventHandler);
521534
}

Assets/MixedRealityToolkit-SDK/Features/UX/Scripts/Controllers/MixedRealityControllerVisualizer.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// Licensed under the MIT License. See LICENSE in the project root for license information.
33

44
using Microsoft.MixedReality.Toolkit.Core.EventDatum.Input;
5+
using Microsoft.MixedReality.Toolkit.Core.Interfaces.Devices;
56
using Microsoft.MixedReality.Toolkit.SDK.Input.Handlers;
67
using UnityEngine;
78

@@ -11,10 +12,13 @@ namespace Microsoft.MixedReality.Toolkit.SDK.UX.Controllers
1112
/// The Mixed Reality Visualization component is primarily responsible for synchronizing the user's current input with controller models.
1213
/// </summary>
1314
/// <seealso cref="Core.Definitions.Devices.MixedRealityControllerMappingProfile"/>
14-
public class MixedRealityControllerVisualizer : ControllerPoseSynchronizer
15+
public class MixedRealityControllerVisualizer : ControllerPoseSynchronizer, IMixedRealityControllerVisualizer
1516
{
1617
// TODO wire up input actions to controller transform nodes / animations
1718

19+
/// <inheritdoc />
20+
public GameObject GameObjectProxy => gameObject;
21+
1822
#region IMixedRealityInputHandler Implementation
1923

2024
/// <summary>

Assets/MixedRealityToolkit-SDK/Profiles/DefaultMixedRealityControllerMappingProfile.asset

Lines changed: 15 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -12,21 +12,12 @@ MonoBehaviour:
1212
m_Name: DefaultMixedRealityControllerMappingProfile
1313
m_EditorClassIdentifier:
1414
isCustomProfile: 0
15-
renderMotionControllers: 1
16-
useDefaultModels: 0
17-
globalLeftHandModel: {fileID: 1370450866519632, guid: 626257b1a6cd47c2a32a18cf75b2fb23,
18-
type: 2}
19-
globalRightHandModel: {fileID: 1760394390528354, guid: 9ef0df44319c4fb4a05649e5b8ceb6d1,
20-
type: 2}
2115
mixedRealityControllerMappingProfiles:
22-
- id: 0
23-
description: MouseController
16+
- description: MouseController
2417
controllerType:
2518
reference: Microsoft.MixedReality.Toolkit.Core.Devices.UnityInput.MouseController,
2619
Microsoft.MixedReality.Toolkit
2720
handedness: 0
28-
useDefaultModel: 0
29-
overrideModel: {fileID: 0}
3021
useCustomInteractionMappings: 0
3122
interactions:
3223
- id: 0
@@ -159,14 +150,11 @@ MonoBehaviour:
159150
axisCodeY:
160151
invertXAxis: 0
161152
invertYAxis: 0
162-
- id: 1
163-
description: UnityTouchController
153+
- description: UnityTouchController
164154
controllerType:
165155
reference: Microsoft.MixedReality.Toolkit.Core.Devices.UnityInput.UnityTouchController,
166156
Microsoft.MixedReality.Toolkit
167157
handedness: 0
168-
useDefaultModel: 0
169-
overrideModel: {fileID: 0}
170158
useCustomInteractionMappings: 0
171159
interactions:
172160
- id: 0
@@ -208,14 +196,11 @@ MonoBehaviour:
208196
axisCodeY:
209197
invertXAxis: 0
210198
invertYAxis: 0
211-
- id: 2
212-
description: Xbox Controller
199+
- description: Xbox Controller
213200
controllerType:
214201
reference: Microsoft.MixedReality.Toolkit.Core.Devices.UnityInput.XboxController,
215202
Microsoft.MixedReality.Toolkit
216203
handedness: 0
217-
useDefaultModel: 0
218-
overrideModel: {fileID: 0}
219204
useCustomInteractionMappings: 0
220205
interactions:
221206
- id: 0
@@ -426,14 +411,11 @@ MonoBehaviour:
426411
axisCodeY:
427412
invertXAxis: 0
428413
invertYAxis: 0
429-
- id: 3
430-
description: Windows Mixed Reality Motion Controller Left
414+
- description: Windows Mixed Reality Motion Controller Left
431415
controllerType:
432416
reference: Microsoft.MixedReality.Toolkit.Core.Devices.WindowsMixedReality.WindowsMixedRealityController,
433417
Microsoft.MixedReality.Toolkit
434418
handedness: 1
435-
useDefaultModel: 0
436-
overrideModel: {fileID: 0}
437419
useCustomInteractionMappings: 0
438420
interactions:
439421
- id: 0
@@ -592,14 +574,11 @@ MonoBehaviour:
592574
axisCodeY:
593575
invertXAxis: 0
594576
invertYAxis: 0
595-
- id: 4
596-
description: Windows Mixed Reality Motion Controller Right
577+
- description: Windows Mixed Reality Motion Controller Right
597578
controllerType:
598579
reference: Microsoft.MixedReality.Toolkit.Core.Devices.WindowsMixedReality.WindowsMixedRealityController,
599580
Microsoft.MixedReality.Toolkit
600581
handedness: 2
601-
useDefaultModel: 0
602-
overrideModel: {fileID: 0}
603582
useCustomInteractionMappings: 0
604583
interactions:
605584
- id: 0
@@ -758,14 +737,11 @@ MonoBehaviour:
758737
axisCodeY:
759738
invertXAxis: 0
760739
invertYAxis: 0
761-
- id: 5
762-
description: Windows Mixed Reality Hand Gestures
740+
- description: Windows Mixed Reality Hand Gestures
763741
controllerType:
764742
reference: Microsoft.MixedReality.Toolkit.Core.Devices.WindowsMixedReality.WindowsMixedRealityController,
765743
Microsoft.MixedReality.Toolkit
766744
handedness: 0
767-
useDefaultModel: 0
768-
overrideModel: {fileID: 0}
769745
useCustomInteractionMappings: 0
770746
interactions:
771747
- id: 0
@@ -924,14 +900,11 @@ MonoBehaviour:
924900
axisCodeY:
925901
invertXAxis: 0
926902
invertYAxis: 0
927-
- id: 6
928-
description: Open VR Motion Controller Left
903+
- description: Open VR Motion Controller Left
929904
controllerType:
930905
reference: Microsoft.MixedReality.Toolkit.Core.Devices.OpenVR.WindowsMixedRealityOpenVRMotionController,
931906
Microsoft.MixedReality.Toolkit
932907
handedness: 1
933-
useDefaultModel: 0
934-
overrideModel: {fileID: 0}
935908
useCustomInteractionMappings: 0
936909
interactions:
937910
- id: 0
@@ -1090,14 +1063,11 @@ MonoBehaviour:
10901063
axisCodeY:
10911064
invertXAxis: 0
10921065
invertYAxis: 0
1093-
- id: 7
1094-
description: Open VR Motion Controller Right
1066+
- description: Open VR Motion Controller Right
10951067
controllerType:
10961068
reference: Microsoft.MixedReality.Toolkit.Core.Devices.OpenVR.WindowsMixedRealityOpenVRMotionController,
10971069
Microsoft.MixedReality.Toolkit
10981070
handedness: 2
1099-
useDefaultModel: 0
1100-
overrideModel: {fileID: 0}
11011071
useCustomInteractionMappings: 0
11021072
interactions:
11031073
- id: 0
@@ -1256,14 +1226,11 @@ MonoBehaviour:
12561226
axisCodeY:
12571227
invertXAxis: 0
12581228
invertYAxis: 0
1259-
- id: 8
1260-
description: Vive Wand Controller Left
1229+
- description: Vive Wand Controller Left
12611230
controllerType:
12621231
reference: Microsoft.MixedReality.Toolkit.Core.Devices.OpenVR.ViveWandController,
12631232
Microsoft.MixedReality.Toolkit
12641233
handedness: 1
1265-
useDefaultModel: 0
1266-
overrideModel: {fileID: 0}
12671234
useCustomInteractionMappings: 0
12681235
interactions:
12691236
- id: 0
@@ -1383,14 +1350,11 @@ MonoBehaviour:
13831350
axisCodeY:
13841351
invertXAxis: 0
13851352
invertYAxis: 0
1386-
- id: 9
1387-
description: Vive Wand Controller Right
1353+
- description: Vive Wand Controller Right
13881354
controllerType:
13891355
reference: Microsoft.MixedReality.Toolkit.Core.Devices.OpenVR.ViveWandController,
13901356
Microsoft.MixedReality.Toolkit
13911357
handedness: 2
1392-
useDefaultModel: 0
1393-
overrideModel: {fileID: 0}
13941358
useCustomInteractionMappings: 0
13951359
interactions:
13961360
- id: 0
@@ -1510,14 +1474,11 @@ MonoBehaviour:
15101474
axisCodeY:
15111475
invertXAxis: 0
15121476
invertYAxis: 0
1513-
- id: 10
1514-
description: Oculus Touch Controller Left
1477+
- description: Oculus Touch Controller Left
15151478
controllerType:
15161479
reference: Microsoft.MixedReality.Toolkit.Core.Devices.OpenVR.OculusTouchController,
15171480
Microsoft.MixedReality.Toolkit
15181481
handedness: 1
1519-
useDefaultModel: 0
1520-
overrideModel: {fileID: 0}
15211482
useCustomInteractionMappings: 0
15221483
interactions:
15231484
- id: 0
@@ -1741,14 +1702,11 @@ MonoBehaviour:
17411702
axisCodeY:
17421703
invertXAxis: 0
17431704
invertYAxis: 0
1744-
- id: 11
1745-
description: Oculus Touch Controller Right
1705+
- description: Oculus Touch Controller Right
17461706
controllerType:
17471707
reference: Microsoft.MixedReality.Toolkit.Core.Devices.OpenVR.OculusTouchController,
17481708
Microsoft.MixedReality.Toolkit
17491709
handedness: 2
1750-
useDefaultModel: 0
1751-
overrideModel: {fileID: 0}
17521710
useCustomInteractionMappings: 0
17531711
interactions:
17541712
- id: 0
@@ -1959,14 +1917,11 @@ MonoBehaviour:
19591917
axisCodeY:
19601918
invertXAxis: 0
19611919
invertYAxis: 0
1962-
- id: 12
1963-
description: Oculus Remote Controller
1920+
- description: Oculus Remote Controller
19641921
controllerType:
19651922
reference: Microsoft.MixedReality.Toolkit.Core.Devices.OpenVR.OculusRemoteController,
19661923
Microsoft.MixedReality.Toolkit
19671924
handedness: 0
1968-
useDefaultModel: 0
1969-
overrideModel: {fileID: 0}
19701925
useCustomInteractionMappings: 0
19711926
interactions:
19721927
- id: 0
@@ -2008,14 +1963,11 @@ MonoBehaviour:
20081963
axisCodeY:
20091964
invertXAxis: 0
20101965
invertYAxis: 0
2011-
- id: 13
2012-
description: Generic OpenVR Controller Left
1966+
- description: Generic OpenVR Controller Left
20131967
controllerType:
20141968
reference: Microsoft.MixedReality.Toolkit.Core.Devices.OpenVR.GenericOpenVRController,
20151969
Microsoft.MixedReality.Toolkit
20161970
handedness: 1
2017-
useDefaultModel: 0
2018-
overrideModel: {fileID: 0}
20191971
useCustomInteractionMappings: 1
20201972
interactions:
20211973
- id: 0
@@ -2174,14 +2126,11 @@ MonoBehaviour:
21742126
axisCodeY: AXIS_18
21752127
invertXAxis: 0
21762128
invertYAxis: 0
2177-
- id: 14
2178-
description: Generic OpenVR Controller Right
2129+
- description: Generic OpenVR Controller Right
21792130
controllerType:
21802131
reference: Microsoft.MixedReality.Toolkit.Core.Devices.OpenVR.GenericOpenVRController,
21812132
Microsoft.MixedReality.Toolkit
21822133
handedness: 2
2183-
useDefaultModel: 0
2184-
overrideModel: {fileID: 0}
21852134
useCustomInteractionMappings: 1
21862135
interactions:
21872136
- id: 0
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
%YAML 1.1
2+
%TAG !u! tag:unity3d.com,2011:
3+
--- !u!114 &11400000
4+
MonoBehaviour:
5+
m_ObjectHideFlags: 0
6+
m_PrefabParentObject: {fileID: 0}
7+
m_PrefabInternal: {fileID: 0}
8+
m_GameObject: {fileID: 0}
9+
m_Enabled: 1
10+
m_EditorHideFlags: 0
11+
m_Script: {fileID: 11500000, guid: 514da61389c049c0bdaf31b7f6970d33, type: 3}
12+
m_Name: DefaultMixedRealityControllerVisualizationProfile
13+
m_EditorClassIdentifier:
14+
isCustomProfile: 0
15+
renderMotionControllers: 1
16+
controllerVisualizationType:
17+
reference: Microsoft.MixedReality.Toolkit.SDK.UX.Controllers.MixedRealityControllerVisualizer,
18+
Microsoft.MixedReality.Toolkit.SDK
19+
useDefaultModels: 0
20+
globalLeftHandModel: {fileID: 1370450866519632, guid: 626257b1a6cd47c2a32a18cf75b2fb23,
21+
type: 2}
22+
globalRightHandModel: {fileID: 1760394390528354, guid: 9ef0df44319c4fb4a05649e5b8ceb6d1,
23+
type: 2}
24+
controllerVisualizationSettings: []

Assets/MixedRealityToolkit-SDK/Profiles/DefaultMixedRealityControllerVisualizationProfile.asset.meta

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

Assets/MixedRealityToolkit-SDK/Profiles/DefaultMixedRealityInputSystemProfile.asset

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,5 @@ MonoBehaviour:
2121
enableControllerMapping: 1
2222
controllerMappingProfile: {fileID: 11400000, guid: 39ded1fd0711a0c448413d0e1ec4f7f3,
2323
type: 2}
24+
controllerVisualizationProfile: {fileID: 11400000, guid: 345c06fdf3732db46b96299bd3cba653,
25+
type: 2}

0 commit comments

Comments
 (0)