WebXR + thumbstick + Quest test?

171 views
Skip to first unread message

demidov...@gmail.com

unread,
Sep 19, 2020, 12:27:55 AM9/19/20
to WebGL Dev List
To control WebXR models (rotation, translation) on the Oculus Go touchpad is used e.g. at https://www.ibiblio.org/e-notes/webxr/mini/micro3q.htm.
They say (e.g. here) that on the Oculus Quest in WebXR the axes are stored like this:
axes = [X-touchpad,Y-touchpad,X-thumbstick,Y-thumbstick]
not sure what is X,Y-touchpad but I'll try
  let source = xrSession.inputSources[0];
  let gp = source.gamepad;
  if(gp){
     let ax, ay;
     if(gp.axes.length == 2){ // Go
       ax = gp.axes[0]; ay = gp.axes[1];
     }else{ // Quest
       ax = gp.axes[2]; ay = gp.axes[3];
     } ...
It works in the Go. Does it work in the Quest?
Sorry but I get permission for the question here (I was waiting for answers 3 months at Oculus dev, Stackoverflow, Discord, Slack :)
By the way what about High Frequency on the Quest?

Evgeny

Paul Masson

unread,
Sep 19, 2020, 1:14:33 AM9/19/20
to webgl-d...@googlegroups.com
I’ve written a general purpose controller that I can confirm works on both Go and Quest. Perhaps this will help:

https://github.com/paulmasson/paulmasson.github.io/blob/master/webxr-worlds/js/VRController.js

Sent from my iPad

On Sep 18, 2020, at 9:27 PM, demidov...@gmail.com <demidov...@gmail.com> wrote:

To control WebXR models (rotation, translation) on the Oculus Go touchpad is used e.g. at https://www.ibiblio.org/e-notes/webxr/mini/micro3q.htm.
--
You received this message because you are subscribed to the Google Groups "WebGL Dev List" group.
To unsubscribe from this group and stop receiving emails from it, send an email to webgl-dev-lis...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/webgl-dev-list/c8eb6b13-a2f8-40d5-a83a-d0d7ca46012bn%40googlegroups.com.

demidov...@gmail.com

unread,
Sep 19, 2020, 2:07:52 AM9/19/20
to WebGL Dev List
Thank you, Paul,
Maybe I shall try to use controller orientation for model rotation (one more step to Quest).
And I get, that inputSources[0/1] corresponds to the right/left controllers.

Brandon Jones

unread,
Sep 19, 2020, 12:19:16 PM9/19/20
to webgl-d...@googlegroups.com
Your code will get the right results for the Quest and Go, though it might be a bit over-simplified for some other controllers.

You can see the expected button and axis mappings for "standard" XR controllers in the WebXR Gamepad Module spec:


--

demidov...@gmail.com

unread,
Sep 19, 2020, 8:23:09 PM9/19/20
to WebGL Dev List
Thank you, Brandon. I've read the spec once more (a bit heavy for me).
1. I have a few more codes for smartphones
  if (gpConnected){
    let gp = window.navigator.getGamepads()[gpIndex];
    let a1 = gp.axes[1];
    angleY = -a1*(.2 + Math.abs(a1))*deltaAngle;
    let a0 = gp.axes[0];
    transl = -a0*(.2 + Math.abs(a0))*deltaTransl;
  }else if(xrSession.inputSources.length){
    let source = xrSession.inputSources[0];
    let gp = source.gamepad;
  ...
Oculus browsers are much more comfortable and I gave my VRbox to a friend.
2. I think I've collected my scripts from Internet. Not sure if I can/shall cash (as global values) e.g. window.navigator.getGamepads()[gpIndex] or xrSession.inputSources ... ? Are the calls expensive?
3. It was unexpected for me that the Quest has "dummy" touchpad X,Y axes. If the Go doesn't have thumbstick X,Y (gp.axes.length == 2) is it a standard axis mapping?

Evgeny

Brandon Jones

unread,
Sep 21, 2020, 12:10:17 PM9/21/20
to webgl-d...@googlegroups.com
window.navigator.getGamepads()[gpIndex] or xrSession.inputSources ... ? Are the calls expensive?

 window.navigator.getGamepads() can be mildly expensive, so in an ideal situation you'd only need to call that once per frame. Indexing into its results is pretty cheap, though. xrSession.inputSources is usually updated in sync with the frame loop, so individual accesses are pretty low cost.

It was unexpected for me that the Quest has "dummy" touchpad X,Y axes. If the Go doesn't have thumbstick X,Y (gp.axes.length == 2) is it a standard axis mapping? 

Yes, the Go is a standard mapping. I realize that it's not ideal for us to have the dummy values, but that's about the only way we could map these things consistently on top of the Gamepad API. Given that touchpads and thumbsticks have different usage assumptions (depending on context) we didn't want to map them to the same indices in some cases because it would make it easy to accidentally treat a touchpad as if it were a thumbstick (or visa-versa) and wind up with an input scheme that you assume works everywhere but in reality fails to deliver a comfortable experience for some percentage of your users. Plus we didn't want to have devices like the Knuckles controllers or WMR wands, which have both touchpads and thumbsticks, conflicting with the layout of other devices. 

--
You received this message because you are subscribed to the Google Groups "WebGL Dev List" group.
To unsubscribe from this group and stop receiving emails from it, send an email to webgl-dev-lis...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages