steamプラグインのVelocityEstimatorを使って、加速度取得をしてみました。

 

インスペクター画面

Estimate On Awakeにチェックを入れておくか、VelocityEstimator.BeginEstimatingVelocity関数を呼べば計測が始まるようです。

 

他の自分のスクリプトなどからアクセスするときは

using Valve.VR.InteractionSystem;

で名前空間を加えた上で、

VelocityEstimator VE = GetComponent<VelocityEstimator>();

などとして取得した後、

VE.GetVelocityEstimate() で速度

VE.GetAccelerationEstimate() で加速度

VE.GetAngularVelocityEstimate() で角速度

をVector3で取得できます!

 

Vector3.magnitudeを使うと、速度などをそれぞれの大きさ(float型)に変換できるので便利です。

 

以下の画像は加速度を取得してログ出力したものです。