WebVR Lab example handle vrdisplaypointerrestricted events

The WebVR lab sample (and others) do not handle the vrdisplaypointerrestricted events, so on some headsets (such as the Windows Mixed Reality devices) mouse input will not work when input is being sent to the headset (ie, it is being worn).

The fix is straightforward, basically just need to take pointerlock in response to window.vrdisplaypointerrestricted event.

I made a forked project with a fix put in to “/scripts/input/gaze/mouse-input.js” (lines 28-34):
WebVR lab - is it possible to put these changes in your example, so anyone forking your project in the future will get this fix?


1 Like

Thank you for the fix @Lewis_Weaver! Do you also happen to know why the mouse goes only left/right?

Unfortunately “Launch” option doesn’t work any longer, do we let old projects just die like that?

I’ve fixed the font issue here: PlayCanvas 3D HTML5 Game Engine but because the WebVR manager/functionality was removed from the engine, it still won’t work from launch

1 Like

Right, we can still just use a working old version of the engine:

PlayCanvas Engine v1.34.0 revision 71086a3
Copyright 2011-2020 PlayCanvas Ltd. All rights reserved.

The editor export zip generator just needs a few old-vs-new changes, e.g. app.loadScene became app.scenes.loadScene.

Thank you for fixing @yaustar! I don’t know which font issue you are referring to, did you mean mouse left/right-is-blocked issue? It indeed works in your example, but I can’t find any commit history of the actual change :see_no_evil:

Edit: I realized what’s wrong, it’s an issue in the LookCamera script - for some reason it believes magic wand is activated while presenting, and then this code is executed:

this._offsetParent.setLocalEulerAngles(0, this.yaw, 0)

I have to learn more about the Lab example, right now I don’t even understand what the magic wand is :sweat_smile:

Edit 2: finally figured it out, the magic window needs to start of being disabled, even though the VR polyfill is active - modern browsers can’t just jump into “presenting” because it requires a user gesture first:

cam = pc.app.root.findByName("Camera");
cam.script.lookCamera._magicWindowEnabled = false;

(so this snippet allows to “fix” the mouse while testing VR mode for cardboard)

There was a font asset related issue that needed fixing to show the text on the billboard

It’s probably related to the old day dream and gear vr 3dof controllers

Edit: wait do you mean magic window or magic wand?

I added more info to my post, it was the magic window in LookCamera script - finally got around that.

Thank you for the asset info, I ran into that on my old 2013 Nexus 7 - funny enough it worked on my new OnePlus 11 in cardboard mode - I first thought it must be some gl extension issue or something.

Can you describe how you fixed the font issue? I can’t find any commit history. Thank you!

(BTW I’m still learning how all the scripts work together, I still don’t grasp the magic wand/window thing)

I’m not sure what the font issue was TBH. It looked like a corrupted data format on the asset itself that threw an error on launch. I had to create a new font asset and update the text elements :thinking:

1 Like