演習 - コレクションを使用したオブジェクトの編成とレイアウト

完了

Mixed Reality Toolkit には、Windows Mixed Reality アプリの開発期間を短縮するために使用できる一連のツールとコンポーネントが用意されています。 Object Bar はそのようなコンポーネントの 1 つです。 ここでは、Object Bar を使用して、ゲーム オブジェクトのセットを編成する手順を示します。

  1. [Hierarchy](ヒエラルキー) ウィンドウで、RoverExplorer オブジェクトを右クリックして [Create Empty](空を作成) を選択し、RoverExplorer オブジェクトの子オブジェクトとして空のオブジェクトを追加します。 そのオブジェクトに「RoverParts」という名前を付けて、[Transform] コンポーネントを次のように構成します。

    • 位置:X = 0、Y = 0.06、Z = 0
    • 回転:X = 0、Y = 90、Z = 0
    • スケール:X = 1、Y = 1、Z = 1

    Screenshot that shows the newly created RoverParts object selected and positioned.

  2. [Hierarchy](ヒエラルキー) で、[RoverExplorer]>[RoverAssembly]>[RoverModel]>[Parts] のすべての子オブジェクトを選択します。 それらを右クリックし、[Duplicate](複製) を選択して各パーツのコピーを作成します。

    Screenshot that shows how to duplicate all the parts selected.

  3. 新しく複製した Parts 子オブジェクトを選択したままにして、それらを RoverParts オブジェクトにドラッグすることで、このオブジェクトの子オブジェクトにします。

    Screenshot that shows the newly duplicated parts as children of the RoverParts object.

  4. シーンでの操作が簡単になるように、[Hierarchy](ヒエラルキー) でオブジェクトの横にあるのアイコンを選択して、RoverAssembly オブジェクトの Scene visibility をオフに切り替えます。 この選択により、ゲーム内での可視性を変更することなく、オブジェクトが [Scene](シーン) ウィンドウで非表示になります。

    Screenshot that shows the RoverAssembly scene visibility off.

  5. [Hierarchy](ヒエラルキー) で、RoverParts 子オブジェクトの名前をクリーンアップするために、名前に追加されている (1)_Part に置き換えます。

    Screenshot that shows how to clean up the duplicated names.

  6. [Hierarchy](ヒエラルキー) で、RoverParts オブジェクトを選択します。 その次に、[インスペクター] ウィンドウで [コポーネントの追加] を選択し、ObjectBar を検索して選択します。 この選択により、ObjectBar コンポーネントが RoverParts オブジェクトに追加されます。

    Screenshot that shows the RoverParts object with Add Component Object Bar in progress.

  7. 次に、Object Bar オブジェクトの数を 5 に設定し、各子パーツをドラッグします。 それらが自動的に互いに集まることを確認します。

    Screenshot that shows the RoverParts added as Object Bar Objects.

  8. ObjectBar コンポーネントの値を次のように構成します。 他のフィールドはすべて既定値のままでかまいません。

    • Object Bar Flow Direction (オブジェクト バーのフローの方向): 横
    • Spacing Between X (X の間隔): 0.25
    • Spacing Between Y (Y の間隔): 0

    RoverParts変換を設定して、別の角度で表示することもできます。 次に例を示します。

    • ローテーション: Y = 0

    Screenshot that shows configuration of the Object Bar properties.