File tree 1 file changed +20
-1
lines changed
Assets/HoloToolkit/Input/Scripts
1 file changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -74,6 +74,7 @@ private void Start()
74
74
if ( spatialInteractionManager != null )
75
75
{
76
76
spatialInteractionManager . SourceDetected += SpatialInteractionManager_SourceDetected ;
77
+ spatialInteractionManager . SourceLost += SpatialInteractionManager_SourceLost ;
77
78
}
78
79
} , true ) ;
79
80
#else
@@ -88,8 +89,8 @@ private void Start()
88
89
}
89
90
90
91
InteractionManager . InteractionSourceDetected += InteractionManager_InteractionSourceDetected ;
91
- #endif
92
92
InteractionManager . InteractionSourceLost += InteractionManager_InteractionSourceLost ;
93
+ #endif
93
94
InteractionManager . InteractionSourceUpdated += InteractionManager_InteractionSourceUpdated ;
94
95
#endif
95
96
}
@@ -120,6 +121,24 @@ private void SpatialInteractionManager_SourceDetected(SpatialInteractionManager
120
121
}
121
122
}
122
123
124
+ private void SpatialInteractionManager_SourceLost ( SpatialInteractionManager sender , SpatialInteractionSourceEventArgs args )
125
+ {
126
+ SpatialInteractionSource source = args . State . Source ;
127
+ if ( source . Kind == SpatialInteractionSourceKind . Controller )
128
+ {
129
+ ControllerInfo controller ;
130
+ if ( controllerDictionary != null && controllerDictionary . TryGetValue ( source . Id , out controller ) )
131
+ {
132
+ controllerDictionary . Remove ( source . Id ) ;
133
+
134
+ UnityEngine . WSA . Application . InvokeOnAppThread ( ( ) =>
135
+ {
136
+ Destroy ( controller ) ;
137
+ } , false ) ;
138
+ }
139
+ }
140
+ }
141
+
123
142
private IEnumerator LoadControllerModel ( SpatialInteractionController controller , SpatialInteractionSource source )
124
143
{
125
144
GameObject controllerModelGameObject ;
You can’t perform that action at this time.
0 commit comments