googlearchive / tango-examples-unity

Project Tango [deprecated] UnitySDK Example Projects
https://developers.google.com/ar
Apache License 2.0
470 stars 242 forks source link

How to do "2D floor plan extraction" in Unity #74

Closed arpit2050 closed 7 years ago

arpit2050 commented 7 years ago

Hello, Does Unity SDK supports 2d-floor plan extraction just like in JAVA API for creating 2d maps for navigation using Project Tango

chaosemer commented 7 years ago

The Unity SDK currently does not support creating 2D floorplans. We have prioritized Java support since it has great support for 2D rendering.

What were you considering using it in Unity for?

arpit2050 commented 7 years ago

I was looking for 2D-Map generation while learning an area using Project Tango with the help of Unity3d so that later I can use that map for understanding navigation in different location within that area learning. Is there any way for generation of 2D map using Unity3D with the help of Project Tango in dynamic runtime.

chaosemer commented 7 years ago

Just for clarification, could you point me to the Java floor plan example you would like to see Unity support as well?

arpit2050 commented 7 years ago

1) https://github.com/googlesamples/tango-examples-java/blob/master/java_floor_plan_example/app/src/main/java/com/projecttango/examples/java/floorplan/FloorplanActivity.java *Custom View that draws the plan in 2D.

chaosemer commented 7 years ago

Thanks for the clarification!

The difficulty you will have here is that building 2D polygons at runtime is not something Unity is especially good at. You could use the Mesh interface to create your vertices and make sure to extrude the mesh yourself. The Java code that builds the polygon is relatively straightforward and could be directly ported to C#.

I hope this helped! I'm going to close this issue as good 2D rendering support is not something our plugin can really address. If you are building primarily a 2D app, I suggest using the C or Java APIs directly.

LudwikJaniuk commented 7 years ago

@chaosemer I understand your reasoning about not having a Unity example for floorplan extraction, but is there any reason why the Unity API doesn't even expose the floorplan extraction function? I would appreciate being able to extract the polygons using the Unity API, but I can't seem to find it at all.

chaosemer commented 7 years ago

@LudwikJaniuk, like I mentioned above, we have prioritized Java support for floorplan extraction as Java has great 2D rendering.

LudwikJaniuk commented 7 years ago

Ok, I understand. Just in case I'd be missing a possible solution - it is not possible to call on the java API from unity C# code, is it? I have found some examples on the internet of calling java code on android from Unity C#, but the examples are pure and simple java language functions. I assume it wouldn't be possible to call the java Tango API in that way (I'm talking specifically about Unity AndroidJavaObject), because of setup and all?

chaosemer commented 7 years ago

If you are willing to do some hookup yourself, I would recommend calling into the C functions over calling into the Java API. Java would work, but calling into C is easier.