VR headset motion not working when forked (LAB)

Hi all. Just started using Pcanvas for archviz. No problem so far under PC, but now it must work underVR enviroment. Taking LAB as a reference nothing seems to work. No motion, no teleport locator. We just forked LAB to check and compare…but even forking nothing works.
Original LAB everyone knows:


This version works perfectly. Using PC I rotate using mouse. Move clicking teleport (better if I could also use arrows…but not). Using my smartphone (samsung S6 in this case) I can watch it and walk around usin touch screen+teleport. It detects gyroscope like AR. Using Samsung Gear works great, too. It detects PAD or controller. It looks like an smart multipurpose solution if we add WASD or arrows.

And now:
Just forked and published . No changes at all:


All works fine but teleport when usin Samsung Gear headset. I can only rotate head. I see teleporter but I can not jump. No matter using pad or controller.

Sometimes when puttings my hands to much on it I get this log text:
[Gamepad-input.js?id=9658493:31]

I uploaded my account to ORG but magically it does not fix it.
LAB is supposed to be a working tutorial for VR beginners…but doesn’t work. Any help with this?
Thanks.

That’s really odd. Can you post the full error message for the gamepad input please? It might be related to the recent changes to the gamepad engine code as mentioned here: [SOLVED] Uncaught TypeError: Cannot read property ‘pad’ of undefined

When a build is published, it is published with a copy of the engine code hence why the older WebVR Lab build is fine but not if you republish with the latest version of the engine.

First of all thanks.
I get no error code.It just doesn´t work. No teleporting. I can not move, just look around.
I got that error when trying no detete objects not needed. I thought that was the mistake: I deleted something with a hidden important script. Then I started from zero again. No deleting. Just forking+publishing. Then no errors but not working.
Do you know any up to date project headset compatible? Just to check scripts and so on…
I should check with Vive, not just Samsung Gear…but too late in my country and Vive in the box. But muy project must work with smartphones, not Vive.

With this error, is it from the DevTools Console or just what appears on screen in the browser?

Edit: Just tried it myself and it’s odd that the old published build works as expected whereas a new build does not. I can’t think of any changes to the engine that would cause this behaviour. The gamepad object from this.app.gamepads.current only has the button array (hence why pad.index.toString() was throwing an undefined error).

Maybe @dave has some ideas?

[Gamepad-input.js?id=9658493:31]
That is what appears on screen in the browser with headset on (when I delete or edit scene). When I remove glasses no such thing…so it’s even hard to memorize. S.GEar detects your head and blanks screen to save battery. I will try to contact Dave. LAB is not useful for VR+headset.

The problem with WebVR is that it’s still changing and very dependent on browser and WebVR Polyfill code which unfortunately means issues like this crops up from time to time as changes are made.

With the Samsung Gear VR internet browser, you can remote connect using devtools (which is what I did) and is very helpful when debugging: https://developer.oculus.com/documentation/vrweb/latest/concepts/carmel-remote-debugging/

Sorry, this looks like another bug caused by the PR for gamepads we released last week.

You should be able to patch the behaviour back to the old version by adding this script to your projects

pc.GamePads.prototype.update = function (dt) {
    var pads = this.poll();

    var i, len = pads.length;
    for (i = 0; i < len; i++) {
        this.previous[i] = this.current[i];
        this.current[i] = pads[i];
    }
};

Were you able to get the full error message happening here? Do you have more info on that?

@OmarShehata @dave

There were two crashes, one was related to the gamepad where pad object only had the button states as properties when it should have an index, hand and pose data. There’s a script in WebVR labs that creates a key from the pad.id and pad.index.

The other was related to audio where the engine was trying to add a listener at NaN, NaN, NaN.

If I get time later this weekend, I post more specific logs.

There were two crashes, one was related to the gamepad where pad object only had the button states as properties when it should have an index, hand and pose data. There’s a script in WebVR labs that creates a key from the pad.id and pad.index.

That should be an easy fix. I noticed that nothing else in the gamepad class was using index, so I didn’t include it.

The other was related to audio where the engine was trying to add a listener at NaN, NaN, NaN.

I’m not sure why this one is happening though.

Also worth noting that WebVR also extends the pad object to include handiness, pose and several other attributes:

Also worth noting that WebVR also extends the pad object to include handiness, pose and several other attributes:

Just doing a proper deep copy of the object sounds like a more robust solution then, as opposed to manually trying to copy all the objects.

I Could get all console information:
After adding Dave’s new scrips we get this: (not working…same results, no pad or controller recognition)

error loading scripts. Open browser console for details.
[gamepad-input js?id=9726547:31]:can not read property “to String” or undefined.

See picture for the rest:

May be this helps…I getting a little bit lost now.

Yes, this is after Dave’s script

I’m deploying a fix to this asap.

If you don’t have same headset or whatever I could do to help or test , just ask. Not sure in wich country you are…but if we are awake, we will

It seems to work after Dave’s last changes!!! no need for xtra scripts. No it’s time to try by myself. Thank you Dave!

Hi again:
We got the projects almost finished:

Still some Xtra programming needed to open doors …
It was supposed to be a multiplattform single file, based on last LAB tutorial.

  • Now it works under PC/Mac (no arrows os WASD…too much to be our first project). UI shows headset icon. If you select it and no headset detected, you get a warning. GREAT!
  • Under android, with touch+gyroscope. If headset detected, stereoscopic mode. GREAT!!! Teleport with controller.
  • But under iOS , only sterescopic mode. No matter we don’t use headset. Only stereovision available. No headset icon to select/deselect headset mode.

The question: How can it be made? May be adding some sort of Xtra iOS personalized scripts?
Some sort of devide detector to be played on? in case player runs on iOS, then another set of scripts are execued???

Try removing line 102 on web-vr-ui.js. That line attempts to enter VR as soon as the user loads the project.

Hi. It worked during a few days. All but BT controller with iOS (teleport + open-close doors)
May be something happened …some iOS update screwed it up just like PC or Android used to during last year…I don’t know.


But now, it works on PC/MAc/Android (touch, VR, pad or BT controlled), and iOS touch but not VR anymore. Of course BT controller never worked. You can use BT controller to play music, pop up volumen etc…but not to navigate VR (iOS)

The customer wants just the only thing we can’t : iOS VR

Some test (WIP)

Nov 17 after your help removing line 102:
iOS OK. After selecting VR mode, entering VR. No controller detected.

Nov 23. Same link.
iOS OK. When entering VR mode, iOS ask for headset. “Place your phone into your cardboard viewer”. No matter what we do we never go any further.

Next try:

Android: working in all cases (BT, pad, VR…all working with samsung gear). With another android device,in VR, BT controller not detected.

iOS: VR not working. BT controller not detected (just like 1st case)
touch pad working.

We usually don’t ask for su much help…but in this case we are lost.