Back to Aframe

tracked-controls

docs/components/tracked-controls.md

1.7.14.3 KB
Original Source

The tracked-controls component interfaces with tracked controllers. tracked-controls uses the Gamepad API to handle tracked controllers, and is abstracted by the hand-controls component as well as the vive-controls, meta-touch-controls, windows-motion-controls components. This component elects the appropriate controller, applies pose to the entity, observes buttons state and emits appropriate events. For non-6DOF controllers, a primitive arm model is used to emulate positional data.

tracked-controls sets two components that handles different Web API versions for VR:

  • tracked-controls-webvr
  • tracked-controls-webxr

Example

Note that due to recent browser-specific changes, Vive controllers may be returned by the Gamepad API with id values of either "OpenVR Gamepad" or "OpenVR Controller", so using idPrefix for Vive / OpenVR controllers is recommended.

html
<a-entity tracked-controls="controller: 0; idPrefix: OpenVR"></a-entity>

Value

PropertyDescriptionDefault Value
autoHideWhether to toggle visibility automatically when controller is connected or disconnected.true
controllerIndex of the controller in array returned by the Gamepad API.0
idSelects the controller from the Gamepad API using exact match.
idPrefixSelects the controller from the Gamepad API using prefix match.
headElementHead element for arm model if needed (if not active camera).
handWhich hand to use, if arm model is needed. (left negates X)right
spaceSpecifies whether to use targetRayspace or gripSpace to determine controller pose.targetRaySpace

Events

Event NameDescription
controllerconnectedController connected and set up.
controllerdisconnectedController disconnected.
axismoveAxis changed (e.g., for thumbstick, touchpad). Contains axis and axesChanged in the event detail. axis is an array of values from -1.0 (left, down) to 1.0 (right, up).
buttonchangedAny touch or press of a button fires this.
buttondownButton pressed.
buttonupButton released.
touchstartTouch sensitive button touched.
touchendTouch sensitive button released.

More Resources