Adding a user-defined target builder

Let's add the UserDefinedTargetBuilder to our project now:

  1. Drag the UserDefinedTargetBuilder prefab from the Vuforia/Prefabs/ folder into Hierarchy.
  2. Check Start Scanning Automatically.

For now, we are telling the target builder to start scanning automatically. This is useful at this point in our development.

But really, we want to control the scanning to occur only while in AR mode. We can add this to the InstructionsController script as follows:

File: InstructionsController.cs 
   public UserDefinedTargetBuildingBehaviour UserDefinedTargetBuilder; 
    
    ... 
 
    void TurnOnArMode() { 
        UserDefinedTargetBuilder.StartScanning(); 
        StandardContent.SetActive(false); 
    } 
 
    void TurnOffArMode() { 
        UserDefinedTargetBuilder.StopScanning(); 
        StandardContent.SetActive(true); 
    } 

Then in Unity:

  1. Drag UserDefinedTargetBuilder onto the Game Controller's User Defined Target Builder slot.

The following screenshot shows the Instructions Controller component now:

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

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