You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While investigating a separate issue (#29861), I found that the haptics example crashes after switching between hands and controllers followed by trying to touch one of the music notes. Error log below
webxr_xr_haptics.html:250 Uncaught TypeError: Cannot read properties of undefined (reading 'frequency')
at handleCollisions (webxr_xr_haptics.html:250:25)
at animate (webxr_xr_haptics.html:299:5)
at onAnimationFrame (three.module.js:27918:36)
at XRSession.onAnimationFrame (three.module.js:13614:3)
Cause of error:
Only 2 oscillators are created and added to the oscillators list, but more than 2 controllers can be added to the controllers list and the same index is used to reference both lists
Proposed solution:
Extract createOscillator() out from initAudio() and use it to create a new oscillator whenever one is not found for the given controller. Increases complexity of code a tiny bit, but not in any way that makes it harder to understand
Alternative solution:
Add oscillators.push( createOscillator() ); 2 more times. Note that things will still break if there are ever more than 4 input sources
More than happy to open a pull request with the changes
Description
While investigating a separate issue (#29861), I found that the haptics example crashes after switching between hands and controllers followed by trying to touch one of the music notes. Error log below
Cause of error:
Only 2 oscillators are created and added to the oscillators list, but more than 2 controllers can be added to the controllers list and the same index is used to reference both lists
Proposed solution:
Extract
createOscillator()
out frominitAudio()
and use it to create a new oscillator whenever one is not found for the given controller. Increases complexity of code a tiny bit, but not in any way that makes it harder to understandAlternative solution:
Add
oscillators.push( createOscillator() );
2 more times. Note that things will still break if there are ever more than 4 input sourcesMore than happy to open a pull request with the changes
Reproduction steps
Code
Live example
Screenshots
No response
Version
r170
Device
Headset
Browser
Chrome
OS
Android
The text was updated successfully, but these errors were encountered: