Overview

In this tutorial, we will be creating an object collection. We will not be any custom scripts (we will only utilize built in MRTK scripts). We will create a new material, a new prefab for the objects arranged by the object collection script, and an object hierarchy to contain the object collection.

Prerequisites

The prerequisites can be completed in about 10 minutes, and only need to be done the first time you set up the MRTK project for this tutorial series. It is important that you are using the MRTK vNext RC1 release. If you use an earlier version of the MRTK you will have issues.

Turorial 03 Begins

Create a new Scene

Duplicate Base_Demo_Scene from the prerequisite steps and rename the duplicate scene as Tutorial_04.

Create New Materials

Add a new Material named DefaultFocusableMaterial and add it to the Assets/App/Content/Materials folder Shader: Mixed Reality Toolkit/Standard Albedo: set color to a Charcoalish color.

and add it to the Assets/App/Content/Materials folder

Add a new Material named CollectionControlPointMaterial and add it to the Assets/App/Content/Materials folder Shader: Mixed Reality Toolkit/Standard Albedo: set color to a Dark Blueish color.

and add it to the Assets/App/Content/Materials folder

Object Collections

The Grid Object Collection and Scatter Object Collection (scripts) allow us to easily layout many child game objects at once.

Create FocusableCube Prefab Add a 3D Cube game object named FocusableCube as child a of SceneContent (our root scene object) . Position: 0, 0, 0 Scale: 1, 1, 1 Material: DefaultFocusableMaterial NOTE : Do not add a rigidBody (we do not want gravity to affect our object collection) Add Component: Interactable HighLight (script) Focus: Enabled Highlight: Disabled (you can change this later to see the effect) Highlight Color: Assign a Green color Outline Color: Assign an pastel greenish color Highlight Material: MRTK_Standard_TransparentLime Overlay Material: MRTK_Standard_TransparentYellow Target Style: Both

as child a of . Save FocusableCube as a prefab by dragging it into the Assets/App/Content/Prefabs folder and delete it from the scene.

Save the project. Create the Object Collection Hierarchy

Add a 3D Sphere game object named SphericalCollectionRoot as child a of SceneContent (our root scene object). Position 0, 1, 1.3 Scale: 0.05, 0.05, 0.05 Material: CollectionControlPointMaterial Add Component: Interactable HighLight (script) Focus: Enabled Highlight Color: Assign a Goldish color Outline Color: Assign an Orangish color Highlight Material: MRTK_Standard_Orange Overlay Material: MRTK_Standard_TransparentOrange Target Style: Both Add Component: Manipulation Handler (script) Manipulation Type: One And Two Handed Two Handed Manipulation Type: Move Rotate Allow Far Manipulation: Checked One Hand Rotation Mode Near: Rotate About Grab Point One Hand Rotation Mode Far: Rotate About Object Center

as child a of (our root scene object).

Save the project.

Add an empty game object named SphericalCollectionFocus as child a of SphericalCollectionRoot Position 0, 4, 0 Scale: 1, 1, 1 Add Component: Grid Object Collection (script) Sort Type: Child Order Surface Type: Sphere Orient Type: Face Origin Layout: Column Then Row Radius: 8 Radial Range: 90 Rows: 4 Cell Width: 1.25 Cell Height: 1.25

as child a of

Save the project.

Drag your FocusableCube prefab on top of the SphericalCollectionFocus game object in the scene to make it a child of SphericalCollectionFocus .

prefab on top of the game object in the scene to make it a child of . Select the FocusableCube prefab in the scene and duplicate the game object 27 times.

prefab in the scene and duplicate the game object 27 times. Select The SphericalCollectionFocus game object in the scene and in the property inspector, click the Update Collection button. This will rearrange the child objects into the sphere layout we selected.

Save the project.

Run the project in the Unity Editor.

Review of Tasks Completed:

We created a two new materials.

We created a new prefab.

We created an object hierarchy that contain the objects arranged by the Grid Object Collection script.

script. Using the Interactable Highlight (script) in multiple locations in our object collection hierarchy allowed us to display different highlights and outlines based on which level of the hierarchy is selected.

Video of Final Result