Code Monkey home page Code Monkey logo

arbook-arunity's Introduction

Augmented Reality for Developers [book] Projects

This repository contains Unity project versions of the book for the following platforms and SDK:

  • Unity experimental-ARInterface, GitHub
  • ARKit and ARCore SDK versions as provided in the ARInterface (commit cited below)
  • Unity 2017.2.0f3

The Unity Technologies experimental-ARInterface is a cross-platform framework for mobile AR shown as part of "So You Think You Can Augment Reality?" talk at Unite Austin 2017. Also see blog post. It allows code-once, build-many so our AR scenes can build for ARKit (iOS) and/or ARCore (Android).

AR Projects

The following book's AR projects are included as separate Unity scenes:

  • Chapter 4 - Augmented Business Cards: Drone
  • Chapter 5 - AR Solar System
  • Chapter 6 - How to Change a Flat Tire
  • Chapter 7 - Augmenting the Instruction Manual
  • Chapter 8 - Room Decoration with AR: Photo Frames
  • Chapter 9 - Poke the Ball Game

About the Book

Augmented Reality for Developers

Build exciting AR applications on mobile and wearable devices with Unity 3D, Vuforia, ARToolKit, Microsoft Mixed Reality HoloLens, Apple ARKit, and Google ARCore

by Jonathan Linowes, Krystian Babilinski

Available at:

How This Implementation Differs from the Book

This repository implements the projects presented in the book using the Unity ARInterface components. The Unity ARInterface (ARI) is experimental and subject to change.

This implementation uses this commit of the ARInterface.

While the ARInterface is convenient, providing a single API for either ARKit or ARCore, it does have limitations. In particular, presently it only detects horizontal planes. Some of our projects pefer vertical planes, or at least, arbitrary planes, and fallback to point cloud.

Chapter 4 - Drone

Uses Unity ARI components for camera and plane hit test.

Chapter 5 - SolarSystem

Uses Unity ARI components for camera and plane hit test.

Chapter 7 - Instruction Manual

Uses Unity ARI components for camera.

In the ARPrompt object, we replace ARHitHandler with a new UnityARIHitHandler script. It uses a horizontal plane to detect the anchor point, and places vertically, and facing the camera.

Chapter 8 - PhotoFrames

Uses Unity ARI components for camera.

Because we only detect horizontal planes, we implemented a new Move mechanic (script MoveToolUnityARI) which detects a plane to set an initial anchor point, and as the user continues touching we modify the Y height of the photoframe. The photoframe is always oriented facing the camera so also be sure to face your wall head-on.

Chapter 9 Notes - Ball Game

An anchor-based version of the ball game (Chapter 9) was not covered directly in the book. For the implementation we basically made a few changes from the Vuforia smart terrain implementation described in the book. The rest of the project is essentially the same.

To anchor the game court in world coordinates we use horizontal plane detection. When the game starts you begin in "anchor mode". Once the court is placed, you press "Play" to begin the "game model" and play game as usual. A "Reset" button returns you to "anchor mode".

Anchor Mode:

  • Instructions panel is displayed
  • Room is scanned and the point cloud particles are displayed
  • User places a temporary game model ("anchor" game object)
  • The CompleteButton click changes to game mode

Game Mode:

  • Instructions panel, anchor model (court), and CompleteButton are hidden
  • Actual ball game objects are displayed
  • Reset button is displayed
  • GameController.StartGame() is called to start

We replace the Vuforia-specific AppStateManager script with the anchor-based AnchorStateManagerUnityARI script. It contains functions, SetGameMode and SetAnchorMode triggered by the CompleteButton and ResetButton, respectively.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.