Building a 6DOF VR (or AR) experience with ARCore in a few minutes

Garrick Clarke, May 28th, 2018

Hi y'all!

 

I'm a gamer and I really enjoy part-taking with the virtual world! When I heard about ARCore, I thought that this would be a great way to transform an Android phone into a VR viewer with 6dof (6 degrees of tracking on the head). The head tracking makes the experience quite immersive as it allows the player to move in the virtual world. In practice, most players don't actually move much but the 6dof tracking allows the user to move his head in every direction, pretty neat!

 

ARCore uses a mixture of IMU information and camera tracking to recover the relative position of the player in the virtual world. It turns out that setting up a demo is pretty straightforward. I thought I would share this with you so that you can experience it first hand.

 

In my next post, I will be describing how to add hand tracking to an experience using the BreqLabs ultrasonic tracking for AR and VR. I like to say AR or VR because the flow is very much the same, the main difference being that you'll want to have a black background for AR so that the real world can be seen.

 

So here's how I did it. Check out the results in the cool video below!

 

 

ARCore Setup Instructions

 

Requirements

Hardware

Software

Create a New Project and Import Package

  • Open Unity and create a new 3D project.
  • Select Assets > Import Package > Custom Package.
  • Select the BreqLabs_ARCore_Demo.unitypackage file you downloaded
  • In the Importing Package dialog, make sure that all package options are selected and click Import.
  • Accept any API upgrades if prompted.

Configure Build Settings

  1. Go to File > Build Settings to open the Build Settings window.
  2. Select Android and click Switch Platform.
  3. In the Build Settings window, click Player Settings.

In the Inspector window, configure the following player settings:

Setting

Value

Player Settings > Other Settings > Multithreaded Rendering

Disable

Player Settings > Other Settings > Package Name

Create Unique Id (com.yourcompany.yourproduct)

Player Settings > Other Settings > Minimum API Level

Android 7.0 or higher

Player Settings > Other Settings > Target API Level

Android 7.0 or higher

Player Settings > XR Settings > ARCore Supported

Enable

Player Settings > XR Setting > Virtual Reality Supported

Select your viewing device

 

Import Scene

  1. Go to Assets > BreqLabsScene and drag it into the scene hierarchy.
  2. Delete the Untitled Scene.
  3. Go to File > Build Settings > Add Open Scenes.

In this scene, Google ARCore’s prefabs are used for the Camera and the Environmental Lighting. The crystal and spotlight have been added as an example but can be changed simply by deleting the game objects and uploading your own.

Upload To Android Device

  1. Enable developer options and USB debugging on your phone.
  2. Connect your phone to your development machine.
  3. In the Unity Build Settings window, click Build and Run.
  4. Unity builds your project into an Android APK, installs it on your phone, and launches it.

Video result:

A screen capture of myself walking around a crystal from the Unity asset store. Awesome!

Powered by CouchCMS