|
@@ -327,11 +327,12 @@ class WebXRManager extends EventDispatcher {
|
|
|
|
|
|
const inputSources = session.inputSources;
|
|
|
|
|
|
- // Assign inputSources to available controllers
|
|
|
+ // Assign controllers to available inputSources
|
|
|
|
|
|
- for ( let i = 0; i < controllers.length; i ++ ) {
|
|
|
+ for ( let i = 0; i < inputSources.length; i ++ ) {
|
|
|
|
|
|
- inputSourcesMap.set( inputSources[ i ], controllers[ i ] );
|
|
|
+ const index = inputSources[ i ].handedness === 'right' ? 1 : 0;
|
|
|
+ inputSourcesMap.set( inputSources[ i ], controllers[ index ] );
|
|
|
|
|
|
}
|
|
|
|
|
@@ -641,10 +642,14 @@ class WebXRManager extends EventDispatcher {
|
|
|
|
|
|
for ( let i = 0; i < controllers.length; i ++ ) {
|
|
|
|
|
|
- const controller = controllers[ i ];
|
|
|
const inputSource = inputSources[ i ];
|
|
|
+ const controller = inputSourcesMap.get( inputSource );
|
|
|
+
|
|
|
+ if ( controller !== undefined ) {
|
|
|
|
|
|
- controller.update( inputSource, frame, referenceSpace );
|
|
|
+ controller.update( inputSource, frame, referenceSpace );
|
|
|
+
|
|
|
+ }
|
|
|
|
|
|
}
|
|
|
|