Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Design domino art creations that interact with the real world using the ARCore Depth API.

License

Notifications You must be signed in to change notification settings

googlecreativelab/lines-of-play

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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 – an AR Experiment with Dominoes

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.

Get it on Google Play

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.

Contents

What is the Depth API?

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.

Building the Project in Unity

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

For Android

  1. Before building and running the app, ensure AR is enabled on your device.
  2. During download, install Android Build Support.
  3. Install Android SDK & NDK Tools and Open JDK.
  4. Download or clone this repository
  5. Add project in Unity Hubs and open project
  6. In Files ▸ Build Settings, Switch build target from PC, Mac and Linux Standalone to Android
  7. Navigate to Edit ▸ Project Settings ▸ Player ▸ Other Settings
  • Turn off Multithreaded Rendering
  • Change color space from Gamma to Linear
  • 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
  1. In Player ▸ XR Settings check ARCore supported
  2. Connect device and allow for USB debugging
  3. Navigate to File ▸ Build Settings, make sure Scene/MainScene is checked in Scenes in Build queue
  4. Build and Run application.

For iOS

  1. During download, install iOS Build Support.
  2. Download or clone this repository
  3. Add project in Unity Hubs and open project
  4. In Files ▸ Build Settings, Switch build target from PC, Mac and Linux Standalone to iOS
  5. 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
  1. In Player ▸ XR Plug-in Management check ARKit for Plug-in Providers
  2. Navigate to File ▸ Build Settings, make sure Scene/MainScene is checked in Scenes in Build queue
  3. Build application and open .xsproj file in XCode to build.

Android troubleshooting for Unity

Click here for troubleshooting help. Also refer to the Unity developer documentation

Using the Placement Tools

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

General Notes

  • 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.

Disclaimer

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.

Contributors

Built by Jasmine Roberts at the Google Creative Lab.

License

Apache 2.0 License

About

Design domino art creations that interact with the real world using the ARCore Depth API.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published