Wiring up the state manager

Back in Unity, we need to populate all the App State Manager variables:

  1. With AppStateManager selected in Hierarchy, drag the SmartTerrain_ImageTarget from Hierarchy onto the Reconstruction Behaviour slot.
  2. Drag the Primary Surface (child of SmartTerrain_ImageTarget) from Hierarchy onto the Surface Behaviour slot.
  3. Drag the ImageTarget from Hierarchy onto the Image Target slot.
  4. Drag the InstructionPanel (child of ScreenSpaceCanvas) object onto Instruction Holder.
  5. Drag InstructionText (child of InstructionPanel) onto the Instruction Text slot.
  6. Drag the CompleteButton onto the Done Button slot.
  7. Drag the RestartButton onto the Restart Button slot.
  8. For the Point Device Text, enter Find target.
  9. For the Pull Back Text, enter Pull back the device slowly, then press Complete.

The component should now look like this in the Inspector:

Next, we need to wire up the buttons:

  1. Select the CompleteButton in Hierarchy then, in Inspector, add an OnClick event by pressing +.
  2. Drag AppStateManager onto the Object slot and choose the AppStateManager | TerrainDone function.
  3. For the RestartButton, also add to its OnClick list, drag the AppStateManager object, and choose the AppStateManager.ResetAll function.

Save the scene and save the project.

Now, when you press Play, you are first prompted to Find target and then asked to Pull back the device slowly until you press Completed. Then you can play the game, or at any point, press Restart to reset and start scanning again.

With Smart Terrain implemented, when you throw the ball it will bounce and roll not just on the court floor we created, but the actual table top and props in the real world. How cool is that?

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset