Project 3: Barrel Bouncer AR Edition

Part 2: Creating Your First AR Scene

Since you are now developing an AR app, you are dealing with your real-world environment, not the virtual world you created in project 1A. Thus, you should start fresh with a new scene since there is a lot going on in the old one. Go ahead and create a new scene. Then, delete the Main Camera gameobject that was automatically added to your scene. You will not need this, since you will add another camera during the setup process that already has the settings and components required for AR applied to it.

Next, go to the menu bar, navigate to GameObject -> XR, and add an AR Session and an AR Session Origin to your scene.

The AR Session gameobject contains two components:

The AR Session Origin gameobject contains a single component called AR Session Origin, whose purpose is to transform trackable features (such as planar surfaces and feature points) into their final position, orientation, and scale in the Unity scene. By default, the origin (coordinate <0,0,0>) of the coordinate system is set based on the initial location of your phone at the beginning of the current AR Session.

The AR Session Origin gameobject also includes a single child gameobject called AR Camera, which contains three additional components (in addition to the default Camera component):

You should also label the AR Camera GameObject with the tag MainCamera.

At this point, if you build and test your app on your phone, you should be able to see the camera stream.

Previous Section | Go Home | Next Section