![](https://img-blog.csdnimg.cn/img_convert/bd4c43c7ae1cd214714927a9f32b4d5b.png)
unity开发arkit
Unity’s ARKit plugin now supports the new augmented reality (AR) features Apple announced in their Spring 2018 Update. The launch of ARKit with iOS 11 put AR into the hands of hundreds of millions of iPhone and iPad users. With the introduction of ARKit 1.5, Apple aims to provide developers with the tools to power more immersive AR experiences that better integrate with the world.
Unity的ARKit插件现在支持Apple在其2018年Spring更新中宣布的新增强现实(AR)功能。 带有iOS 11的ARKit的推出使AR进入了数亿iPhone和iPad用户的手中。 随着ARKit 1.5的推出,Apple旨在为开发人员提供工具,以提供更身临其境的AR体验,从而更好地与世界融合。
With Unity’s updated ARKit plugin, developers can now take full advantage of the new ARKit 1.5 tools to create a new generation of AR apps. In addition to horizontal surfaces, you can now recognize vertical objects on vertical surfaces and map irregularly shaped surfaces with more accuracy. Find and recognize the position of real world 2D images and turn them into AR experiences such as bringing artwork to life. Other new features include relocalization, video formats, auto-focus and the ability to reset the world origin.
借助Unity更新的ARKit插件,开发人员现在可以充分利用新的ARKit 1.5工具来创建新一代的AR应用程序。 现在,除了水平表面之外,您还可以识别垂直表面上的垂直对象,并更精确地映射不规则形状的表面。 找到并识别现实世界2D图像的位置,并将其转变为AR体验,例如将艺术品变为现实。 其他新功能包括重新定位,视频格式,自动对焦以及重置世界原点的功能。
Download the updated plugin from Bitbucket and read below to start developing with the ARKit Spring 2018 update using Unity.
从 Bitbucket 下载更新的插件 并阅读以下内容,以开始使用Unity开发ARKit Spring 2018更新。
建立 (Setup)
要求 (Requirements)
iOS device that supports ARKit and that has the latest iOS 11.3 beta image from the Apple developer site installed.
支持ARKit并安装了Apple开发人员网站中最新的iOS 11.3 beta映像的 iOS设备。
Unity version 2017.1 or above.
Unity版本2017.1或更高版本 。
Latest XCode 9.3 beta from the Apple Developer website (requires macOS 10.13)
Apple Developer网站上的最新XCode 9.3 beta版 (需要macOS 10.13)
Latest version of the “spring2018_update” branch of the Unity ARKit Plugin Bitbucket repo.
Unity ARKit插件Bitbucket存储库中“ spring2018_update”分支的最新版本。
脚步 (Steps)
垂直平面 (Vertical Planes)
One of the most popular new features is vertical planes. When the original ARKit was released, only horizontal planes were detected, and many developers clamored for vertical planes detection. With this update, Apple have answered this call and provided vertical planes detection. In Unity, you can see this as an extra entry in the UnityARPlaneDetection enum. We also added another entry in case you wanted to detect both vertical and horizontal planes at the same time. We also added the “vertical” entry in the ARPlaneAnchorAlignment enum so that you can identify the orientation of each plane anchor detected.
最受欢迎的新功能之一是垂直平面。 当最初的ARKit发行时,仅检测到水平平面,许多开发人员大声疾呼要求检测垂直平面。 在此更新中,Apple已应答此呼叫并提供了垂直平面检测。 在Unity中,您可以在UnityARPlaneDetection枚举中将其视为额外的条目。 如果您想同时检测垂直和水平平面,我们还添加了另一个条目。 我们还在ARPlaneAnchorAlignment枚举中添加了“垂直”条目,以便您可以识别所检测到的每个平面锚的方向。
Instead of a new example to show this feature, our original “Assets/UnityARKitPlugin /Examples/UnityARKitScene /UnityARKitScene.scene” can be used along with a slight modification of UnityCameraManager.cs to allow you to detect both horizontal and vertical planes with your configuration.
可以使用我们原始的“ Assets / UnityARKitPlugin / Examples / UnityARKitScene /UnityARKitScene.scene ”来代替展示此功能的新示例,并稍加修改UnityCameraManager.cs以允许您通过配置同时检测水平和垂直平面。
![](https://img-blog.csdnimg.cn/img_convert/7dcff01dd81da64b5d5808dc699afe49.png)
![](https://img-blog.csdnimg.cn/img_convert/5edbc14d080ab73aae4b2549ea7bae35.png)
平面边界和细部网格 (Plane boundaries and detail mesh)
With this update, instead of just plane centers and rectangle extents, ARKit now provides a more detailed visualization of the boundary of the plane and also a detailed mesh of the shape of the flat surface detected.
通过此更新,ARKit现在不仅提供了平面中心和矩形范围,还提供了平面边界的更详细的可视化以及检测到的平面形状的详细网格。
The implementation of this is via an ARPlaneGeometry item that is returned as part of an ARPlaneAnchor. Further examination of this item will show a structure similar to ARFaceGeometry which you will remember from ARKit Face Tracking for iPhone X.
这是通过ARPlaneGeometry项目实现的,该项目作为ARPlaneAnchor的一部分返回。 对该项目的进一步检查将显示类似于ARFaceGeometry的结构,您会从iPhone X的ARKit Face Tracking中记住该结构。
You will be given an array of vectors which represent the boundary points, which can be plugged into a LineRenderer to give a representation of the boundary of the flat surface that has been detected. You will also be given an array of vertices, texture coordinates at those vertices, and a list of indices for the triangles of the detail mesh that represents the shape of the surface.
您将获得代表边界点的向量数组,可以将这些向量插入LineRenderer中,以表示已检测到的平面边界。 您还将获得一个顶点数组,这些顶点处的纹理坐标以及一个表示表面形状的局部网格的三角形的索引列表。
To see how to use this information, have a look at Assets/UnityARKitPlugin/Examples /ARKit1.5/UnityARPlaneMesh/UnityARPlaneMesh.scene. This scene is setup just like our original UnityARKitScene above, but the GeneratePlanes GameObject has a reference to ARKitPlaneGeometry prefab instead of the debugPlanePrefab.
要查看