immersive-web / webxr-polyfill

Use the WebXR Device API today, providing fallbacks to native WebVR 1.1 and Cardboard
Apache License 2.0
378 stars 84 forks source link

Eventual crash on HoloLens from GamepadXRInputSource #153

Open speigg opened 3 years ago

speigg commented 3 years ago

Runs fine for several minutes w/ hand tracking, until the following crash occurs:

Unable to get property '0' of undefined or null reference
TypeError: Unable to get property '0' of undefined or null reference
   at fromRotationTranslation (https://cdn.jsdelivr.net/npm/webxr-polyfill@latest/build/webxr-polyfill.js:301:3)
   at GamepadXRInputSource.prototype.updateBasePoseMatrix (https://cdn.jsdelivr.net/npm/webxr-polyfill@latest/build/webxr-polyfill.js:5541:7)
   at GamepadXRInputSource.prototype.getXRPose (https://cdn.jsdelivr.net/npm/webxr-polyfill@latest/build/webxr-polyfill.js:5548:5)
   at WebVRDevice.prototype.getInputPose (https://cdn.jsdelivr.net/npm/webxr-polyfill@latest/build/webxr-polyfill.js:5897:9)
   at XRFrame.prototype.getPose (https://cdn.jsdelivr.net/npm/webxr-polyfill@latest/build/webxr-polyfill.js:1295:7)
   at update (https://10.0.0.72:1234/index.4ca7163e.js:17013:11)
   at onAnimationFrame (https://10.0.0.72:1234/index.4ca7163e.js:17380:7)
   at onAnimationFrame (https://10.0.0.72:1234/index.4ca7163e.js:10529:5)
   at Anonymous function[PRIVATE$15].onDeviceFrame (https://cdn.jsdelivr.net/npm/webxr-polyfill@latest/build/webxr-polyfill.js:1465:7)

Note, I had to include a DOMPointReadOnly polyfill in order to run on HoloLens2 (as per #144)

speigg commented 3 years ago

The problem seems to be that GamepadXRInputSource.prototype.updateBasePoseMatrix() assumes that the gamepad's pose orientation will always be available when position is available.