Unity + Vuforia マーカトラッキングメモ
はじめに
Unity + Vuforia でマーカトラッキングをするための自分用メモ
対象は iPad (iOS12)
環境
- MacOS
- Unity 2018.2.8f1
- Vuforia 7.2.23
- iPad6 (iOS12)
マーカトラッキング
Vuforia は Unity に統合されたので初めから入っている
「MainCamera」を削除して GameObject > Vuforia > ARCamera を選択
このとき、Vuforia のパッケージがインポートされる
- Assets
- Editor
- Vuforia
次に、GameObject > Vuforia > Image を選択して「ImageTarget」を作成
このとき、Vuforia のパッケージがさらにインポートされる
- Assets
- StreamingAssets
- Resources
最後に、BuildSttings > PlayerSettings > XR Settings > VuforiaAugmentedReality にチェックを入れる
これでマーカ(デフォルトではAstronaut)が認識できる
VuforiaConfiguration
Assets > Resources > VuforiaConfiguration で Vuforia の設定とかできる
またここで Vuforia のバージョンも確認できる
「Device Tracker」にチェックを入れる
「Tracking mode」は「POSITIONAL」
「ARCamera」の「World Center Mode」が「DEVICE」になっている
おまけ1
マーカを認識して何かするスクリプトは、Assets > Vuforia > Scritps > DefaultTrackableEventHandler
このスクリプトをいじるといろいろできる
おまけ2
Blender で作成した fbsファイル(例:Arrows.fbs)のオブジェクト
Unity にインポートすると
- Assets
- Camera
- Cone
- Cylinder
- Lamp
となっている
オブジェクト一つひとつに「Camera」と「Lamp」が付いていると処理がとても重くなるので 削除するか無効にしておく
おわりに
Unity + Vuforia でマーカをトラッキングする方法をまとめた