Gamepad

altspace~ Gamepad

new Gamepad()

Represents a gamepad. Can be retrived via altspace.getGamepads. See the official Gamepad spec for more details.

See https://github.com/AltspaceVR/AltspaceSDK/examples/steamvr for a usage example

SteamVR Gamepad Mappings

Buttons

Index Button
0 Trigger (analog)
1 Grip
2 Touchpad
4 Touchpad Up
5 Touchpad Right
6 Touchpad Down
7 Touchpad Left

Axes

Index Axis
0 Touchpad X
1 Touchpad Y

Oculus Touch Gamepad Mappings

Buttons

Index Button
0 Index Trigger (analog)
1 Hand Trigger (analog)
2 Thumbstick
3 Button One (A/X)
4 Button Two (B/Y)
5 Thumbrest (touch)

Axes

Index Axis
0 Thumbstick X
1 Thumbstick Y
Properties:
Name Type Description
connected Boolean

Whether the controller is connected.

mapping string

Controller mapping. In addtion to the "standard" mapping in the HTML5 Gamepad spec. SteamVR input devices are exposed with a "steamvr" mapping. Oculus touch is exposed with a "touch" mapping.

buttons Array.<module:altspace~GamepadButton>

An array representing the buttons present on the gamepad.

hand string

"left" for the controller in the users left hand, "right for the right hand. If only one controller is connected, only a "right" controller will be returned..

position object

The position in enclosure space of a SteamVR input device (only available on gamepads with mapping == 'steamvr' or mapping == 'touch')

Properties
Name Type Description
x number

x coordinate

y number

y coordinate

z number

z coordinate

rotation object

The orientation quaternion in enclosure space of a SteamVR input device (only available on gamepads with mapping == 'steamvr' or mapping == 'touch').

Properties
Name Type Description
x number

x component

y number

y component

z number

z component

w number

w component

Methods

preventDefault(axes, buttons)

Prevents default actions on specific axes and buttons.

Parameters:
Name Type Description
axes Array

An array of booleans, arranged according to the axis order of the layout. A true value for a given location will block the default action for that axis.

buttons Array

An array of booleans, arranged according to the button order of the layout. A true value for a given location will block the default action for that button.