0

[Edit added 17 Sept 2015]

In the latest version of Google Chrome I am calling:

var arr = navigator.getGamepads();

which results in:

arr = [undefined, undefined, undefined, undefined];

I have a Logitech Pro connected in a usb port on my pc.

I am calling navigator.getGamepads when the user clicks a select box where he chooses either Keyboard, Joystick 1 or Joystick 2. I am calling navigator.getGamepads to see if an element of arr (ie a gamepad) has index 0 or index 1 for when the user selects Joystick 1 or Joystick 2 respectively. But obviously since each gamepad is undefined, I do not even get that far.

Anyone know why this is going wrong? Why is my Logitech pro not being recognised?

Edit: It is only working in Firefox. It does not work on the latest version of Google Chrome. It does not work in Internet Explorer 11.

Rewind
  • 2,554
  • 3
  • 30
  • 56
  • It's an experimental feature, what browser are you using? In Chrome 45 with no gampads connected I'm seeing a GamepadList object with 4 undefined properties https://developer.mozilla.org/en-US/docs/Web/API/Navigator/getGamepads – bcr Sep 16 '15 at 21:59
  • make sure the gamepad mode is set to "X" on the tiny switch on its back. if that doesn't help, or it doesn't have a switch, then you can't use that gamepad. not all of them work. edit: maybe it's "D" you want, can't recall, try them both. you have to unplug and replug and reload to repopulate the array. – dandavis Sep 16 '15 at 22:01
  • Thanks for your quick responses so far. I am using Google Chrome Version 45.0.2454.93 m. I have a Joystick (Logitech Pro) which has no such buttons. – Rewind Sep 16 '15 at 22:12
  • sounds like you need to use a different gamepad :( (there's no hidden setting to adjust or anything, it either shows up or it doesn't) – dandavis Sep 16 '15 at 22:27

0 Answers0