はじめに
Oculus Goのコントローラからレーザーポインタを表示するサンプルを動かしてみます。
準備
- 【Oculus Go】コントローラを表示する
- OVRInputModule Part1をインポートする
- OVRInputModule Part2をインポートする
- OVRInputModule Part3をインポートする
手順
1. レーザーポイント用のオブジェクトの追加
Hierarchy上で「Create Empty」を追加し、オブジェクト名を「Selection Visualizer」とする。

2. Line Rendererの追加
Selection Visualizerのコンポーネントに「Line Renderer」を追加する。

インスペクタで、設定を以下のように変更する。
項目名 | 値 |
---|---|
Cast Shadows | off |
Receive Shadows | off |
Width | 0.020 |

ラインレンダラーの詳細はこちら
3. レーザーポインタの先端用のオブジェクトの追加
SelectionVisualizer上で、「Sphere」を追加する。

scaleのx,y,zのscaleを0.05に変更する。

4. OVRPointerVisualizerの追加
Selection Visualizerのコンポーネントに「OVRPointerVisualizer」を追加する。

インスペクタで、設定を以下のように変更する。
項目名 | 値 |
---|---|
Tracking Space | OVRCameraRig > TrackingSpace |
Line Pointer | Selection Visualizer |
Gaze Pointer | Selection Viualizer > Shpere |

動作確認
無事、レーザポインタが表示されました。
(おまけ)レーザーの色を変更する。
MaterialsのElement0を変更すると、色を変更できるようです。
