donmccurdy/aframe-gamepad-controls

Controls from all gamepads

Juleffel opened this issue · 4 comments

Hi ! Thanks for this great project !

As I understand it, currently we can use controls from only one source, chosen by the controller attribute. Would there be a way to indicate that we want the controls to be read from all the controllers?

Thanks !

Update: I currently treated the case by adding multiple=true; in the component and then called gamepad-controls multiple times:

gamepad-controls__0="controller:0;flyEnabled: true;"
gamepad-controls__1="controller:1;flyEnabled: true;"
gamepad-controls__2="controller:2;flyEnabled: true;"
gamepad-controls__3="controller:3;flyEnabled: true;"

Aframe reference:
https://aframe.io/docs/0.7.0/core/component.html#multiple

Hi! I'm curious what you'd like to use multiple controllers for? I'd be OK with adding multiple=true, but I don't think it sounds common enough to do something like controller:all.

In fact I use this on a very simple experience with HTC Vive, and I need the controls to react whichever controller the user take. It may be a bit specific, I agree :)

By the way, up and down seem to be inversed on HTC Vive, I added this to my code:

      inv = ((gamepad.id == "OpenVR Gamepad")? -1 : 1);
  if (Math.abs(inputX) > JOYSTICK_EPS) {
    ...
  if (Math.abs(inputY) > JOYSTICK_EPS) {
    velocity[rollAxis] += inv * inputY * acceleration * dt / 1000;

Not sure "OpenVR Gamepad" doen't mess with other controllers, though...

Oh ok, yes that does make sense.

I'd try to detect Vive controllers with: gamepad.id.indexOf('OpenVR ') === 0, since that's how A-Frame currently does it. Do you want to send a PR fixing that and adding multiple: true? :)

This project is no longer maintained. I recommend using movement-controls from A-Frame Extras instead.