File tree 2 files changed +13
-5
lines changed
2 files changed +13
-5
lines changed Original file line number Diff line number Diff line change @@ -83,10 +83,13 @@ class XRHandModelFactory {
83
83
84
84
}
85
85
86
+ controller . visible = true ;
87
+
86
88
} ) ;
87
89
88
90
controller . addEventListener ( 'disconnected' , ( ) => {
89
91
92
+ controller . visible = false ;
90
93
// handModel.motionController = null;
91
94
// handModel.remove( scene );
92
95
// scene = null;
Original file line number Diff line number Diff line change @@ -327,11 +327,12 @@ class WebXRManager extends EventDispatcher {
327
327
328
328
const inputSources = session . inputSources ;
329
329
330
- // Assign inputSources to available controllers
330
+ // Assign controllers to available inputSources
331
331
332
- for ( let i = 0 ; i < controllers . length ; i ++ ) {
332
+ for ( let i = 0 ; i < inputSources . length ; i ++ ) {
333
333
334
- inputSourcesMap . set ( inputSources [ i ] , controllers [ i ] ) ;
334
+ const index = inputSources [ i ] . handedness === 'right' ? 1 : 0 ;
335
+ inputSourcesMap . set ( inputSources [ i ] , controllers [ index ] ) ;
335
336
336
337
}
337
338
@@ -641,10 +642,14 @@ class WebXRManager extends EventDispatcher {
641
642
642
643
for ( let i = 0 ; i < controllers . length ; i ++ ) {
643
644
644
- const controller = controllers [ i ] ;
645
645
const inputSource = inputSources [ i ] ;
646
+ const controller = inputSourcesMap . get ( inputSource ) ;
647
+
648
+ if ( controller !== undefined ) {
646
649
647
- controller . update ( inputSource , frame , referenceSpace ) ;
650
+ controller . update ( inputSource , frame , referenceSpace ) ;
651
+
652
+ }
648
653
649
654
}
650
655
You can’t perform that action at this time.
0 commit comments