Back to Aframe

meta-touch-controls

docs/components/meta-touch-controls.md

1.7.14.3 KB
Original Source

The meta-touch-controls (formerly oculus-touch-controls) component interfaces with the Meta Touch controllers (Rift, Rift S, Oculus Quest 1, 2, 3 and 3s). It wraps the tracked-controls component while adding button mappings, events, and a Touch controller model.

Example

html
<a-entity meta-touch-controls="hand: left"></a-entity>
<a-entity meta-touch-controls="hand: right"></a-entity>

Value

PropertyDescriptionDefault Value
handThe hand that will be tracked (i.e., right, left).left
modelWhether the Touch controller model is loaded.true

Events

Event NameDescription
triggerdownTrigger pressed.
triggerupTrigger released.
triggertouchstartTrigger touched.
triggertouchendTrigger no longer touched.
triggerchangedTrigger changed.
thumbstickdownThumbstick pressed.
thumbstickupThumbstick released.
thumbsticktouchstartThumbstick touched.
thumbsticktouchendThumbstick no longer touched.
thumbstickchangedThumbstick changed.
thumbstickmovedThumbstick direction changed.
gripdownGrip button pressed.
gripupGrip button released.
griptouchstartGrip button touched.
griptouchendGrip button no longer touched.
gripchangedGrip button changed.
abuttondownA button pressed.
abuttonupA button released.
abuttontouchstartA button touched.
abuttontouchendA button no longer touched.
abuttonchangedA button changed.
bbuttondownB button pressed.
bbuttonupB button released.
bbuttontouchstartB button touched.
bbuttontouchendB button no longer touched.
bbuttonchangedB button changed.
xbuttondownX button pressed.
xbuttonupX button released.
xbuttontouchstartX button touched.
xbuttontouchendX button no longer touched.
xbuttonchangedX button changed.
ybuttondownY button pressed.
ybuttonupY button released.
ybuttontouchstartY button touched.
ybuttontouchendY button no longer touched.
ybuttonchangedY button changed.
surfacedownSurface button pressed.
surfaceupSurface button released.
surfacetouchstartSurface button touched.
surfacetouchendSurface button no longer touched.
surfacechangedSurface button changed.

Read thumbstick values

Listen to the thumbstick event and the values are available in the object passed to the handler

html
<a-entity meta-touch-controls="hand: left" thumbstick-logging></a-entity>
<a-entity meta-touch-controls="hand: right" thumbstick-logging></a-entity>
javascript
AFRAME.registerComponent('thumbstick-logging',{
  init: function () {
    this.el.addEventListener('thumbstickmoved', this.logThumbstick);
  },
  logThumbstick: function (evt) {
    if (evt.detail.y > 0.95) { console.log("DOWN"); }
    if (evt.detail.y < -0.95) { console.log("UP"); }
    if (evt.detail.x < -0.95) { console.log("LEFT"); }
    if (evt.detail.x > 0.95) { console.log("RIGHT"); }
  }
});

Assets