Unity Support Library Tutorial

This page describes how to use features of the Tango Support Library in Unity. For more information about the support library, see our Tango Support Library overview.

Installation Instructions

The support library is included in the .unitypackage on our Downloads page.

Support Library Tutorial

The support library contains functions to help you manage and use data from the Tango API. Current features of the library include plane fitting to depth data.

Depth Perception Plane Fitting

A common use case in augmented reality (AR) applications is placing a virtual object on real world surfaces like walls, floors, tabletops, etc. This uses a combination of Depth Perception and Motion Tracking. The FindPlane helper function of TangoPointCloud fits a plane model to the depth data near a specified screen location and returns the plane and a position on the plane in 3D space.

This example implements this plane fitting in Unity:

TangoPointCloud pc = GameObject.FindObjectOfType<TangoPointCloud>();
Camera cam = Camera.main;

if (Input.touchCount == 1)
    Touch t = Input.GetTouch(0);
    Vector3 planeCenter;
    Plane plane;
    if (pc.FindPlane(cam, t.position, out planeCenter, out plane))
        Debug.Log("Found plane");

The output plane and planeCenter use the Unity World reference frame. The Augmented Reality scene of the PublicExamples project shows a full example of integrating the plane fitting function.

Enviar comentarios sobre…