LoginSignup
0
0

More than 5 years have passed since last update.

Instant Preview下でXRNodeの情報が反映されない(Daydream)

Last updated at Posted at 2018-11-09

環境

  • Unity 2017.4.3f1
  • Mirage Solo(Daydream)用のアプリ開発
  • Instant Preview ver1.1.1にて確認

症状

  • HMDの位置や回転情報が取得できない。

    • InputTracking.GetLocalRotation(XRNode.CenterEye)
    • InputTracking.GetLocalRotation(XRNode.Head)
  • Debug.Logで取得した値を吐かせてみると(0.0, 0.0, 0.0)しか返ってこない。

  • エラーは吐いてない。

  • カメラもHMDに追従している。

解決法

コンソールに

Virtual Reality SDK Daydream is not supported in Editor Play Mode. Please Build and run on a supported target device.
Will attempt to enable None instead.

とあったのでもしやとは思ったのだけれど、ビルドしたら普通に動いた。
Instant Preview状況下では反映されないようです。

Instant Preview下でもカメラ側にHMDの動きが反映されるので惑わされますが、XRNodeを使ってHMDから能動的に情報を取ってこようとすると、ビルドしないとダメみたい ¯_(ツ)_/¯

もっといい解決法(※18/12/6追記)

いちいちビルドしていると非常に不便なのでInstant Previewで確認がしたい。
Instant Preview下であってもmainCameraはHMDの動きに追従するので、カメラの情報を引っ張ってこればInstant Pewview下でもHMDの情報を取ってくることができる。

Vector3 angle = InputTracking.GetLocalRotation(XRNode.CenterEye).eulerAngles;

Vector3 angle = mainCamera.transform.localEulerAngles;

というイメージ。

0
0
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
0
0