Class: GamepadHelper

GamepadHelper()

Gamepad helper class used by HUD and VRHelper, NOT used by 3rd person camera. Implementes UI control with gamepad: selecting and activating HUD buttons in and out of XR, and XR teleportation and interaction with scene. As gamepad is not standard XR controller, and mobiles don't come with XR controller, this is the only option to interact with scene in mobile VR. Traverse through hud menus with gamepad buttons, left/right/up/down, either left or right hand. Activate current option with either trigger or up. To teleport and rotate in (mobile) XR, use thumbstick, and to interact, use trigger.

Constructor

new GamepadHelper()

Source:

Classes

GamepadHelper

Members

instance :GamepadHelper

Type:
Source:

Methods

forwardToHud()

Returns true if HUD can process gamepad event, i.e. a button or form is currently active.
Source:

gamepadButton(index, state)

Gamepad button event handler. Buttons left/right/up/down are forwarded to the HUD. Trigger button and select button events are forwarded either to HUD, or to the scene, as appropriate.
Parameters:
Name Type Description
index button index, see https://github.com/alvaromontoro/gamecontroller.js/blob/master/public/gamepad.svg
state true/false for pressed/released
Source:

trackGamepad()

Main point of gamepad support, called from the constructor. Once the browser emits gamepadconnected event, installs tracker function into main rendering loop, to track states that rotate the camera, teleport, and fire gamepad button events.
Source: