Gamepad index
Button/Axis definition
button or axis code id
Optionalthreshold?: numberhow far past the deadzone the axis must travel to
trigger the keycode. It is ADDED to input.setGamepadDeadzone, it does
not replace it, so with the default deadzone of 0.1 a threshold of 0.5 fires
at 0.6 of full deflection. Its SIGN picks the half of the axis to watch:
negative for left/up, positive for right/down, and the two halves are bound
separately. Ignored for "buttons", which take the browser's own pressed
state; the deadzone reaches a button only where a non-standard mapping
routes an axis onto one through its analog array.
"buttons" or "axes"
(See input.KEY)
if keyCode has no action bound to it yet — call
input.bindKey first.
// enable the keyboard
me.input.bindKey(me.input.KEY.X, "shoot");
...
// map the lower face button on the first gamepad to the X key
me.input.bindGamepad(0, {type:"buttons", code: me.input.GAMEPAD.BUTTONS.FACE_1}, me.input.KEY.X);
// map the left half of the stick to LEFT, firing at 0.6 of full travel
// (0.1 deadzone + 0.5 threshold), and the right half to RIGHT
me.input.bindGamepad(0, {type:"axes", code: me.input.GAMEPAD.AXES.LX, threshold: -0.5}, me.input.KEY.LEFT);
me.input.bindGamepad(0, {type:"axes", code: me.input.GAMEPAD.AXES.LX, threshold: 0.5}, me.input.KEY.RIGHT);
Associate a gamepad event to a keycode