Tango增强现实(AR)应用程序帮助将虚拟物体(从新的客厅家具到全尺寸的恐龙)放置到您真实的物理世界中。我们使用Project Tango的深度API将虚拟猫添加到真实世界中。当用户触摸通过其设备的相机观看的表面时,它创建基于真实世界的几何形状的虚拟猫,并将猫放置在表面上。该应用程序使用深度相机来定位挖掘的表面,并放置虚拟的猫在正确的3D位置。
1 添加预制件
在TangoPrefabs文件夹中,找到Tango Camera预制件,然后将其拖动到Hierarchy面板,
同样将Tango Point Cloud预制也拖动到Hierarchy面板;
2 配置Tango Manager
在“ Hierarchy”面板中,选择“ Tango Manager”,然后在Inspector面板中确保选中以下选项:
Auto-connect to Service.
Enable Motion Tracking with Auto Reset.
Enable Depth
Enable Video Overlay with Method = Texture (ITangoCameraTexture)
3 创建一个UI控制器
On the GameObject menu, click Create Empty.
4 添加脚本
In the Inspector panel, click Add Component.
In the Component drop-down menu, click New Script. (You may have to scroll down to see it.)
In the New Script dialog, change the name to "KittyUIController".
image.png
KittyUIController.cs 将处理触摸事件,调用 FindPlane()函数,并将你的小猫放到场景中。
网友评论