This project is no longer actively maintained by the Google Creative Lab but remains here in a read-only Archive mode so that it can continue to assist developers that may find the examples helpful. We aren’t able to address all pull requests or bug reports but outstanding issues will remain in read-only mode for reference purposes. Also, please note that some of the dependencies may not be up to date and there hasn’t been any QA done in a while so your mileage may vary.
For more details on how Archiving affects Github repositories see this documentation . We welcome users to fork this repository should there be more useful, community-driven efforts that can help continue what this project began. |
Lines of Play is a domino AR experiment built with Unity highlighting recent advancements in ARCore. Unlike previous mobile AR applications limited to horizontal and vertical object placement, AR Core's Depth API allows game objects to interact with real objects in the player’s environment with near surface-level resolution.
Features of the player’s environment provide constraints (on collision) and serve as visual obstructions (occlusion). Players can use Lines of Play to rapidly create and modify lines, rings, paths, and turns of domino tiles.
This app was developed in the Unity Editor and written in C# using the MonoDevelop framework and using ARFoundation. ARFoundation allows build to target both capable iOS and Android devices.
For a list of supported Android devices, check here; for supported iOS devices and more information check here.
- What is the Depth API?
- Building the Project in Unity
- Using the Placement Tools
- General Notes
- Disclaimer
- Contributors
The ARCore Depth API enables depth map creation using a single camera without the use of peripheral hardware. The source gets different references to keep the depth textures up to date, retrieves focal length in pixels and transforms a camera-space vertex into world space.
A depth map is created by taking multiple images from different angles and comparing them as phone is moved and estimating the distance to every pixel. This depth-map determines which objects are closer to the player and thus whether a virtual object placed in the environment should appear overlapped by a real-world object.
Download the Unity Editor (this application was developed using 2018.4 (LTS)
Note: If this is your first time using the Unity Editor, install the Unity Hub
- Before building and running the app, ensure AR is enabled on your device.
- During download, install
Android Build Support
. - Install
Android SDK & NDK
Tools andOpen JDK
. - Download or clone this repository
- Add project in Unity Hubs and open project
- In Files ▸ Build Settings, Switch build target from
PC, Mac and Linux Standalone
toAndroid
- Navigate to Edit ▸ Project Settings ▸ Player ▸ Other Settings
- Turn off
Multithreaded Rendering
- Change color space from
Gamma
toLinear
- Turn off
Autographics API
- Enable
Open GLES3
- Set to minimum API level to
Android 9.0 (Pie)
API level 24 or higher - Set unique names for Product Name and Package Name
- In Player ▸ XR Settings check
ARCore supported
- Connect device and allow for USB debugging
- Navigate to File ▸ Build Settings, make sure
Scene/MainScene
is checked in Scenes in Build queue Build and Run
application.
- During download, install
iOS Build Support
. - Download or clone this repository
- Add project in Unity Hubs and open project
- In Files ▸ Build Settings, Switch build target from
PC, Mac and Linux Standalone
toiOS
- Navigate to Edit ▸ Project Settings ▸ Player ▸ Other Settings
- Set string for
Camera Usage Description
- Enable
Requires ARKit support
- Set Target device to
iPhone + iPad
- Set Target minimum iOS version to
11.0
- Change architecture to
ARM64
- Set unique names for Product Name and Package Name
- In Player ▸ XR Plug-in Management check
ARKit
for Plug-in Providers - Navigate to File ▸ Build Settings, make sure
Scene/MainScene
is checked in Scenes in Build queue Build
application and open .xsproj file in XCode to build.
Click here for troubleshooting help. Also refer to the Unity developer documentation
After application start, once scene has been scanned, a phantom domino tile is raycast onto the ground plane to provide a preview of where the domino will appear when the user taps the screen. Players can place multiple domino tiles using this method or can toggle between pre- defined path placement modes in the application’s interface.
There are five different modes of domino path placement:
- Single placement - Players can tap to place individual domino tiles (as previously mentioned)
- Line placement - Players can draw a path by specifying two points A and B and generate a line of dominoes
- Circle placement - Players can generate a ring of dominoes by specifying a center point of the circle and a point on its circumference
- Square placement - Player can specify two points A and B, that comprise the diagonal of a square. This is referred to as a 90-degree turn
- Draw to place - Players can freeform draw on surfaces and a path of equidistant dominos will generate
-
For the Depth API to work, the user needs to move their phone for a few seconds before occlusion starts working reliably
-
Optimal range is 1-3 meters (near and far depth estimates are less accurate)
-
Dynamic objects do not immediately occlude. This adjusts when the scene becomes static
For more information about ARFoundation, check here.
This is not an official Google product, but an AR Experiment developed at the Google Creative Lab. We’ll do our best to support and maintain this experiment but your mileage may vary.
We encourage open sourcing projects as a way of learning from each other. Please respect our and other creators’ rights, including copyright and trademark rights when present, when sharing these works and creating derivative work. If you want more info on Google's policy, you can find that here.
Built by Jasmine Roberts at the Google Creative Lab.