oculus-touch-controls コンポーネントは、Oculus Touch コントローラ(Rift、Rift S、Oculus Quest 1 および 2)とのインターフェイスを提供します。tracked-controls コンポーネント をラップし、ボタンマッピング、イベント、および Touch コントローラモデルを追加しています。

#

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

# Value

Property 概要 デフォルト値
hand 追跡される手(すなわち、右、左)。 left
model タッチコントローラーモデルがロードされているかどうか。 true
orientationOffset モデルの向きに適用するオフセット x: 0, y: 0, z: 0

# イベント

イベント名 概要
triggerdown トリガーを押した状態。
triggerup トリガーを離した
triggertouchstart トリガがタッチされた
triggertouchend トリガがもはやタッチされていない
triggerchanged トリガーが変更された
thumbstickdown サムスティックが押された
thumbstickup サムスティックが離された。
thumbsticktouchstart サムスティックのタッチ操作
thumbsticktouchend サムスティックのタッチが終了しました。
thumbstickchanged サムネイルが変更されました。
thumbstickmoved サムネイルの方向が変わりました
gripdown グリップボタンが押された
gripup グリップボタンが離された状態
griptouchstart グリップボタンが押された状態
griptouchend グリップボタンが押されなくなった状態
gripchanged グリップボタンが変更されました。
abuttondown Aボタンが押されました。
abuttonup Aボタンが離されました。
abuttontouchstart Aボタンがタッチされました。
abuttontouchend Aボタンがもはやタッチされていない。
abuttonchanged Aボタンが変更されました。
bbuttondown Bボタンが押されました。
bbuttonup ボタンが離されました。
bbuttontouchstart Bボタンがタッチされました。
bbuttontouchend Bボタンがもはやタッチされていない。
bbuttonchanged Bボタンが変更されました。
xbuttondown Xボタンが押されました。
xbuttonup Xボタンが離されました。
xbuttontouchstart Xボタンがタッチされました。
xbuttontouchend Xボタンがもはやタッチされていない。
xbuttonchanged Xボタンが変更されました。
ybuttondown Yボタンが押されました。
ybuttonup Yボタンが離されました。
ybuttontouchstart Yボタンがタッチされました。
ybuttontouchend Yボタンがもはやタッチされていない。
ybuttonchanged Yボタンが変更されました。
surfacedown Surfaceボタンが押されました。
surfaceup Surfaceボタンが離されました。
surfacetouchstart Surfaceボタンがもはやタッチされました。
surfacetouchend Surfaceボタンがもはやタッチされていない。
surfacechanged Surfaceボタンが変更されました。

# サムスティックthumbstickの値を読む

サムスティックイベントをリッスンし、ハンドラに渡されたオブジェクトで値を利用することができる

<a-entity oculus-touch-controls="hand: left" thumbstick-logging></a-entity>
<a-entity oculus-touch-controls="hand: right" thumbstick-logging></a-entity>
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