[SOLVED] How are VIVE Controllers supposed to work in the WebVR Lab scene


I’m just wondering what the intended behavior of VIVE controllers is in the WebVR lab scene. I’ve been working on a project with a friend (who has a VIVE) and he says that when he loads up that scene he gets the following controller behavior:

  • The user’s gaze determines the position of the reticule
  • Pulling the trigger makes you teleport to the reticule position
  • The controllers are “invisible”

What I would have expected would be:

  • The controller(s) determine the position of the reticule (i.e. I can point the controller where I want to go)
  • The controllers are visible

I’m just wondering, what’s the intended behavior? Is something not working on my friend’s end of things? Looking at the six-dof-controller.js file, it looks like the raycast behavior is all in there, so I’m thinking that it’s supposed to be raycasting directly from the controller, not from the user’s gaze.

It sounds to me like his VIVE isn’t even using the controllers–that it’s still using the regular Gaze Controller and just treating a controller trigger pull as a mouse click. If that’s the case, any idea why it wouldn’t be using the controllers properly?


Can you mention what browser build he is using exactly? As I assume there should be a special build for HTC Vive controllers still.

@yaustar - is the best to tackle your question here, here is a VR guy :slight_smile:

1 Like

Thanks @max! Am I right that what my friend is experiencing is not the intended behavior?

I’ll check with him to figure out browser; I’m pretty sure he’s using Chromium but will have to verify that.

If he tests other WebVR apps that actually work within same browser, and ours gives weird behavior, then it is probably worth investigating this.

I know that he has used Sketchfab’s VR scene’s on the VIVE without issue (including controller use)–I’ve been over to his house and tested a few Sketchfab scenes and they worked great (controllers seemed to work 100%). And the PlayCanvas one’s are working great–everything except the controllers.

I no longer have access to an VR kit (boo!) but someone from the Firefox team did try out the WebVR Labs with Firefox Nightly and the Vive with success. I vaguely remember that Chromium doesn’t support the Vive Controllers. If that’s changed, be sure to enable the flags in the config for the extended gamepad API.

You are right though, the controllers should be visible and control the direction of the reticle.

If they don’t appear, then it means that VrGamepadManager isn’t detecting any gamepads that a ‘hand id’.

As I’m typing this, I’m thinking it may be possible that the Vive Controllers may not have hand ids (left, right, ‘none’) depending on the implementation. It’s pretty easy to check if you debug through the _updatePadToHandMappings function and inspect the gamepad object.

Edit: Can your friend try this project and see if the controllers appear? I’ve made a minor tweak to VrGamepadManager (line 74) which will hopefully work. (Untested as I don’t have the equipment) https://playcanvas.com/project/476529/overview/chromium-with-vive-fix

1 Like

Thanks @yaustar! I’ll let you know what his results are after he tests the project you linked to. Thanks for looking in to that!

Hi Pete, Yaustar and Max,

I’m Pete’s friend - the guy with the VIVE.

This link has the following behaviors:

In Chromium Version 56.0.2910.0 (64-bit)

  • No controllers visible
  • No Navigation available

Firefox Nightly 55.0a1 (2017-04-21) (64-bit)
– Does not recognize the VIVE

Note Both of these browsers have worked with Sketchfab where the controllers are visible and where the controllers work with navigation.

Hmm… That’s annoying. Unfortunately I don’t have access to a Vive to debug.

I’ve added a console.log of the pad object, would it be possible to run the project again and provide a screenshot of the developer console please? Hopefully with that, I should be able to work something out despite not having the gear at hand (fingers crossed): https://playcanv.as/p/2W8r4f6s/

1 Like

Here are the error messages that I get on the console when loading with the VIVE

playcanvas-stable.min.js:16 Powered by PlayCanvas 0.211.0 d46f277
__game-scripts.js:1 InvalidStateError: API can only be initiated by a user gesture.
(anonymous) @ __game-scripts.js:1
playcanvas-stable.min.js:780 submitFrame must be called within a VRDisplay.requestAnimationFrame callback.
submitFrame @ playcanvas-stable.min.js:780
4__game-scripts.js:1 {}

I believe they are warnings rather than errors. Do you get nothing else printed in console beyond that or just lots of {}?

No - that’s all that shows up on the console. - It would be nice if we could reproduce this on a different VIVE headset. Let me know if there is anything else you would like for me to try. The strange thing is that I can go to Sketchfab and the controllers work fine.

Cheers. Sorry about this, it’s been a while since I wrote that code and I’m now looking at places where it could fall over :confused:

Can you try the build again please? https://playcanv.as/p/2W8r4f6s/

I’ve got rid of some optimisations so it should print out more in the log. It just showing {} is very strange as it means there’s a pad detected but with no data (?) so I’m wondering if it takes a while before the pads are initialised?

Hi All,

WebVR in Chrome requires an Origin Trail token in the page and these expire every month or so. I’ve just updated ours on the published app page.

This could have been the problem as using VR controllers requires the working WebVR API (no the polyfill).

Try again now and see if it works properly?


1 Like

Yep! That did it. They’re tracking great now. Thanks!

1 Like