Adding an AR camera

Next, we need an AR camera. We can use the default Main Camera already in the scene, but it must be parented by ARRoot.

  1. Select Main Camera from the Hierarchy and drag it to make it a child of ARRoot.
  2. Reset the Main Camera's position to (0, 0, 0) if necessary (Transform gear-icon | Reset).
  3. We want this camera only to be working with objects in Root. Therefore, set its Culling Mask to AR Background 2 so that it matches the layer that Root is in (select Culling Mask | Nothing, then Culling Mast | AR Background 2).
  4. Then, use Add Component to add the AR Camera component to the camera.
You can readily reset the Transform Values by using the gear icon in the upper right of the Transform pane and selecting Reset.

The Hierarchy should now look like this:

At this point we can test it. When you press Play (the play-icon on the toolbar at the top-center of Unity), you should see the feed from your web camera in the Game panel. This allows you to debug the AR application within the Unity editor.

On Windows systems, immediately after pressing Play, you may be presented with a Properties dialog that lets you choose your webcam device (if you have more than one) and its properties. This dialog is part of the ARToolkit and is launched because, in your AR Controller, the Video Config (Windows) property includes the directive -show Dialog.

You can exert a great deal of control over the physical camera options via this component. Using C# scripts you can write. You can also use the separate calib_camera camera calibration utility included with the ARToolkit tools. See more at https://archive.artoolkit.org/documentation/doku.php?id=2_Configuration:config_camera_calibration.

Troubleshooting
If you encounter an error like DllNotFoundException: [...]/Assets/Plugins/ARWrapper.dll locate the DLL file(s) in the projects Assets/Plugins/x86_64 path (if running 64 bit Unity on Windows, for instance), and make sure that Editor is one of the Include Platforms specified. We have heard of cases where developers never got it to work when using Play from the Unity Editor, but could still successfully build and run to their Android device just the same.
..................Content has been hidden....................

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