1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

【VR開発】Meta Questコントローラーの速度を取得する

Posted at

はじめに

こんにちは。
ジョジョ好きなXRクリエイターの もふるね です。

今は院試が終わってルンルンでVR開発をしてるところです。
開発で得た知識を備忘録として残します。

開発環境
・Unity 2022.3.20f1
・Meta XR Core SDK
・Meta XR Interaction SDK Essentials
・Oculus XR Plugin
使用機材
・Meta Quest2

結果

速度をとって、速度の数値をテキストとバーで可視化しています。
速度の大きさが1を超えると色が緑から赤に変化します。

つくりかた

速度をとるコード

// 左手のコントローラを変数に登録
OVRInput.Controller LeftController = OVRInput.Controller.LTouch;
// コントローラの速度を取得
Vector3 LConVel = OVRInput.GetLocalControllerVelocity(LeftController);
// 速度の大きさを計算
VelValue = LConVel.sqrMagnitude;

取得できるコントローラの速度はx,y,z軸それぞれの速度です。
sqrMagnitudeでxyzそれぞれの速度の2乗を足した値を計算しています。

取得できるデータはOculus Integrationで取得出来るOculus Goの主要な入力【Unity】【VR】【アセット】【Oculus Go】を参考にしました。

応用

手を速く動かすとロウソクの火が消える仕組みをつくってみた

振り返り

ホラゲーが好きなので、コントローラーの速度を活かしたVRホラゲーつくってみたい。
最近はバイオ7と8を買った。怖い。最高。

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?