0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

arfoundation-samplesのBounding Box Detection について

0
Posted at

About

arfoundation-samplesをビルドし一通り動作確認した中で、動作を把握しきれなかったものを追加確認していきます。単なるビルドでは確認できない項目のため、記事を分割しています。
今回は Bounding Box Detection についてです。

まとめ

  • BBounding Box Detection Sceneに不具合があり機能利用ができない状態でした。
    • 対象GameObjectが非アクティブの状態
    • Awake時に対象GameObjectの有効化ができていない

本編

概要

事前にシステム定義されたオブジェクト一覧があり、それに一致する領域にBounding Boxを生成するサンプルとなっています。詳細はAR FoundationではなくARKitパッケージのドキュメントに記載がありました。

シーンを起動すると画面下部にキャプチャ開始ボタンが表示され、押下で検出が開始されます。
ボタン上の白帯部分には、キャプチャ状態に関する報告が出力されます。

有効な検出対象(テーブル、机など一般的な住環境に存在する家具系)の位置に矩形と、分類情報が画面に表示されます。また矩形をタップした面にアンカーが配置されます。

検出例 アンカー設置
alt text alt text

修正内容

シーン内のGameObject "Room Capture UI"にアタッチされたスクリプト "RoomPlanRoomCapture.cs"があります。スクリプト内のAwakeコードが下記になるのですが、環境に応じて自身の子オブジェクトを有効化しています。

void Awake()
{
...
#if UNITY_IOS && !UNITY_EDITOR
    if (m_RoomCaptureInfo != null)
    {
        m_RoomCaptureInfo.SetActive(true);
    }
    var version = iOS.Device.systemVersion;
...
    if (m_RoomCaptureButton != null)
    {
        m_RoomCaptureButton.SetActive(true);
    }
    m_SupportsRoomCapture = true;
#else
    if (m_RoomCaptureButton != null)
    {
        m_RoomCaptureButton.SetActive(false);
    }
    if (m_RoomCaptureInfo != null)
    {
        m_RoomCaptureInfo.SetActive(false);
    }
#endif
}

子オブジェクトの有効化処理は行っていますが、親オブジェクト自体の有効化がコード内で行われていない状況で、かつシーン上の"Room Capture UI"はデフォルトが非アクティブとなっていました。このままでは子オブジェクトを有効化してもUI上は見えないままなので、"Room Capture UI"を有効に変更しました。

alt text alt text

この変更により、概要セクションで示した動作確認が可能になりました。

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?