Closed tbalouet closed 6 years ago
The recursion error leaves me the believe this isn't polyfill related -- does this work on native VR platforms (S8 on Chrome should be able to enable native WebVR)? I haven't dug into the Unity WebVR exporter yet, if this works on native WebVR I'll dig into it more!
Reading more in the exporter issues (https://github.com/mozilla/unity-webvr-export/issues/113), it appears there may be different limits in Unity's exported JS
I was able to run this on Chrome 64 with native WebVR enabled successfully; sometimes did get an 'Uncaught RangeError: Array buffer allocation failed'.
Here's an image with more information on the recursion.
It looks like webvr.js
overwrites window.requestAnimationFrame
with a function that calls VRDisplay's raf or a saved window.raf depending on if we're presenting or not. In polyfill land, the VRDisplay's raf ultimately calls window.requestAnimationFrame
since we don't have a real VRDisplay, resulting in the recursion.
The fix here would be to cache the window.requestAnimationFrame in the polyfill, and could also be fixed by not overwriting window.raf in the Unity exporter. I suggest both! I'll make a fix for this.
Fixed in https://github.com/immersive-web/cardboard-vr-display/commit/6f6a0c1e8b28eb4a3c861aeab4f814e93207fb85, cardboard-vr-display@1.0.6 -- need to uplift and release in the polyfill, and will need to be added in exporter via https://github.com/mozilla/unity-webvr-export/issues/113
Description:
Trying an experience using the Mozilla's Unity exporter on mobile, there seems to be an error when entering the VR mode. Example to test: http://adityabawankule.me/Unity/WebVR/Beach/index.html Unity-to-webvr library: https://hacks.mozilla.org/2018/02/create-vr-on-the-web-using-unity3d/ Log of the error (Range error at the end)
Result: it produces a distorted view of the experience, but everything's frozen and we have to leave the page.
Additional Information: