-
-
Notifications
You must be signed in to change notification settings - Fork 36k
Closed
Closed
Copy link
Labels
Description
TLDR: Lack of null check for controllers in onSessionEnd
causes errors if getController
is never called
It seems controllers are only created when getController
or getControllerGrip
are called. if those functions are never called, we end up with null controllers in the inputSourcesMap
three.js/src/renderers/webxr/WebXRManager.js
Lines 337 to 344 in 1238a32
// Assign controllers to available inputSources | |
for ( let i = 0; i < inputSources.length; i ++ ) { | |
const index = inputSources[ i ].handedness === 'right' ? 1 : 0; | |
inputSourcesMap.set( inputSources[ i ], controllers[ index ] ); | |
} |
Once the session ends, there's no null check for the controllers when trying to disconnect them as seen below
three.js/src/renderers/webxr/WebXRManager.js
Lines 132 to 138 in 1238a32
function onSessionEnd() { | |
inputSourcesMap.forEach( function ( controller, inputSource ) { | |
controller.disconnect( inputSource ); | |
} ); |