Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when going into VR mode using Polyfill with Unity exporter #308

Closed
ghost opened this issue Feb 23, 2018 · 5 comments
Closed

Error when going into VR mode using Polyfill with Unity exporter #308

ghost opened this issue Feb 23, 2018 · 5 comments
Assignees

Comments

@ghost
Copy link

ghost commented Feb 23, 2018

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)
screenshot from 2018-02-22 15-41-10

Result: it produces a distorted view of the experience, but everything's frozen and we have to leave the page.

Additional Information:
  • webvr-polyfill version: 0.9.36
  • Browser name/version/release channel: tested on Samsung Internet Browser and Chrome on Samsung S8
  • Operating System: Android 7.0
@jsantell
Copy link
Contributor

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!

@jsantell
Copy link
Contributor

Reading more in the exporter issues (MozillaReality/unity-webxr-export#113), it appears there may be different limits in Unity's exported JS

@jsantell
Copy link
Contributor

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.

screenshot from 2018-02-23 09-52-20

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.

jsantell added a commit to immersive-web/cardboard-vr-display that referenced this issue Feb 23, 2018
@jsantell
Copy link
Contributor

Fixed in immersive-web/cardboard-vr-display@6f6a0c1, [email protected] -- need to uplift and release in the polyfill, and will need to be added in exporter via MozillaReality/unity-webxr-export#113

@jsantell
Copy link
Contributor

Fixed in 0.10.3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant