I am having a strange kind of issue this morning. I make lots of HTC Vive apps which use the controllers. Published versions of these apps that were made a few days ago are working fine but when I try to publish them now (even without any changes) the controllers no longer work. There are no errors in the console so I am not sure why they are not working anymore. Launching from the editor works fine, its simply when published that the controllers don’t move.
It looks like the latest version of Chrome experimental might be the cause
I tracked it down to this line of code
var gamepads = navigator.getGamepads();
In the editor launch this object contains 2 controllers and 2 undefined
In the published launch this object contains 4 undefined.
If it’s not too much trouble I wouldn’t mind a second opinion that its the latest chrome thats causing it
my version is 55.0.2842.0
what I don’t get is why this line of code is producing two different results in the same browser?
UPDATE: looks like i am not the only one
UPDATE: I am wondering if it’s a bug in the new version of chrome and on secure https:// sites? I am waiting for someone on the forums to confirm that this is the case. But if it is why are older published versions working and newer ones not? Could something in the recent playcanvas changes caused a bug to surface?
Did you get chance to see my edits on the thread?
My best guess is that it’s some kind of cross-domain security issue which effects the latest version of chrome and it’s the recent changes to playcanvas publishing which is bringing it to light. Possible?
Sadly no change, running the editor in https:// still works and running the published in http: doesn’t
So to summarise so far:
Before the recent publishing changes it worked in both editor and published
After the playcanvas changes and after updating to the latest version of chrome it works in editor but not in published
Older published versions before the playcanvas changes work fine.
Other people besides playcanvas users are experiencing similar issues
Still pointing to a browser issue and CORS and I think that the playcanvas changes are simply throwing light on it.
The latest on the issue thread above has confirmed that it is recent changes to the security model in chrome experimental which is causing the gamepads not to work. However oddly testing seems to indicate it breaks http:// but works for https:// (it’s even effecting the sample demos on the webvr.info site). So at the moment I am stuck not being able to publish any new projects using vive controllers.
There is no such thing as “invalidate security” of a page.
One thing comes into my mind is where exactly .js files are served from, and if that is different domain and/or non-https, it might lead to that issue.
One way to check is to create very simple, minimal project that purely tries to detect if getGamepads works (not even using any libraries, just vanilla js), then do different options of serving files to verify which works and which doesn’t.
It’s starting to look like it may be some kind of issue with the changes to the webvr spec and the existing webvr plugin for PlayCanvas.
It seems not all webvr applications on the internet are effected. For example in PlayCanvas the editor launched version is uneffected but the published versions are. Many of the webvr demos around the web are still working, Sketchfab site is still working. So it’s only certain sites that are effected including your own.
As I understand it the HMD has to be started and the controllers need to be moved or buttons pressed before the controllers appear in navigator.getgamepads() (that has certainly been the case in the past) so perhaps it’s something to do with the way the HMD is initialised on PlayCanvas which is preventing the getgamepads() from initializing.
So it appears that not all websites are initializing the environment the same way.
It’s possible that the next version of chrome experimental will take a step back but I doubt it, more likely people creating plugins like yourself will probably have to update their code to keep pace.
But I think the clue to sorting this problem is that the unpublished versions work but the published ones do not. So there has to be something different in how they run?
Only a week or so ago I noted a bug where code that reference app.graphicsDevice would work fine in the editor but not in the published version and only after changing it to this.app.graphicsDevice did it work in both. So perhaps it’s something like that hanging around in the webvr plugin scripts that might be the source of the issue.
That’s great news but I am having difficulty getting into the site to test the changes. I keep getting security warning popping up complaining about the certificate and when I go into the editor it just constantly disconnects. It only seems to be happening on the current chrome experimental, normal chrome appears unaffected. Unfortunately I need the experimental version in order to test the gamepads on the HTC Vive.
as one door opens …
UPDATE: Managed to fix my certificate problem (out of date build of chrome exp) and the first test was successful ! going to test a few but its looking good…
ANOTHER UPDATE: Confirmed, gamepads are working fine now with published versions! Yea!
Thank you very much whoever figured out the problem