File tree Expand file tree Collapse file tree 1 file changed +20
-1
lines changed
Assets/HoloToolkit/Input/Scripts Expand file tree Collapse file tree 1 file changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -74,6 +74,7 @@ private void Start()
7474 if ( spatialInteractionManager != null )
7575 {
7676 spatialInteractionManager . SourceDetected += SpatialInteractionManager_SourceDetected ;
77+ spatialInteractionManager . SourceLost += SpatialInteractionManager_SourceLost ;
7778 }
7879 } , true ) ;
7980#else
@@ -88,8 +89,8 @@ private void Start()
8889 }
8990
9091 InteractionManager . InteractionSourceDetected += InteractionManager_InteractionSourceDetected ;
91- #endif
9292 InteractionManager . InteractionSourceLost += InteractionManager_InteractionSourceLost ;
93+ #endif
9394 InteractionManager . InteractionSourceUpdated += InteractionManager_InteractionSourceUpdated ;
9495#endif
9596 }
@@ -120,6 +121,24 @@ private void SpatialInteractionManager_SourceDetected(SpatialInteractionManager
120121 }
121122 }
122123
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+
123142 private IEnumerator LoadControllerModel ( SpatialInteractionController controller , SpatialInteractionSource source )
124143 {
125144 GameObject controllerModelGameObject ;
You can’t perform that action at this time.
0 commit comments