Hacker News new | ask | show | jobs
by wtallis 5423 days ago
The explanation of the analog stick axes needs clarification: "For example, the XBox wired controller has 4 axes (top to bottom, left to right, and two diagonals.)" What's a diagonal axis, if not a linear combination of the vertical and horizontal axes?

At minimum, for an Xbox-style controller, you should be seeing a vertical and horizontal axis for each of the two analog sticks, and an axis for each of the two analog triggers. From an original Xbox controller, you should also have six analog buttons (though they are usually treated as standard binary buttons).

Other than that, this looks pretty cool. Perhaps in a few years, we'll see stuff like this combined with WebGL to make an open-source, cross-platform gaming environment that goes way beyond the current crop of 2d Flash games.

2 comments

Agree, the quoted sentence made absolutely no sense to me either. I wonder if it's a misunderstanding on the part of the article author(s), or if it's communicated that way by Mozilla, too.

I had a look at https://wiki.mozilla.org/JoystickAPI and it simply says "unsigned long axis: axis number being moved", without examplifying for a known device. Didn't continue digging to the actual implementation.

Even sillier, I'm pretty sure it has 5 axes.

Left Stick X and Y, Right Stick X and Y, And another Axis used for the 2 triggers.

Yeah, I know how silly that sounds for the triggers, but that's how it works.

That does sound odd, since it's possible to detect the state of the triggers independently. The configuration utility for the Xbox Controller driver that I use allows me to map any of the physical axes to the virtual axes X, Y, Z, Rx, Ry, Rz, and Slider, so I guess that's roughly what's supported by the Windows input APIs. I don't really know how it's reported by the controller, though, other than the fact that it isn't standard USB HID.