Search code examples
unity-game-enginedepthgoogle-project-tango

Implementing ITangoDepth in Unity. Project Tango


I'm creating a programfor project tango in Unity and i'm trying to make a class implementing ITangoDepth. Just for testing I've made this class implement the method OnTangoDepthAvailable just for printing a text, so I can see the thing workin. I can't -.-' This is what I have:

public void Start(){
    m_tangoApplication = FindObjectOfType<TangoApplication>();
    m_tangoApplication.Register(this);
}

public void OnTangoDepthAvailable(TangoUnityDepth tangoDepth)
{
    // Calculate the time since the last successful depth data
    // collection.
    debug = "Depth Available";

}

I've enabled Depth in TangoManager too.

I've been a long time studying the code in Point Cloud example but i don't see what else do I have to set to enable the depth sensor. Can anyone help me make this work?

Thanks so much :)

EDIT: OK. I think i found the problem, but it created another one: in my app I'm using a material that shows what the camera sees in a plane in front of the camera. When i disable this plane it all works properly. Is it possible that camera and depth sensor can't work the same time??


Solution

  • You can only use the Tango API to use access the camera if you are using the depth. That's being said, the webcam texture in Unity won't work when the depth is enabled. The augmented reality example uses both depth and color image together, you can take a look of that.