当前位置: 首页 > 文档资料 > A-Frame 中文文档 >

tracked-controls

优质
小牛编辑
143浏览
2023-12-01

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 componentas well as the vive-controlsand oculus-touch-controlscomponents. This component elects the appropriate controller, applies pose to the entity, observes buttons state and emits appropriate events.

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.

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

Value

PropertyDescriptionDefault Value
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.

Events

Event NameDescription
axismoveAxis changed.
buttonchangedAny touch or press of a button fires this.
buttondownButton pressed.
buttonupButton released.
touchstartTouch sensitive button touched.
touchendTouch sensitive button released.

More Resources