arkit unity

by Francesco Pallotta

由Francesco Pallotta

凯蒂猫! 如何使用ARKit和Unity制作增强现实应用程序。 (Hello, Kitty! How to make an augmented reality app using ARKit and Unity.)

We’ve all heard of Augmented Reality (AR), but at this point there are few opportunities to see this technology in action. We know that AR allows us to see virtual elements fused with the real world around us. For example, with AR we can see a virtual sofa in our room. Apple now lets us see new items added to the real world using the cameras in our phones.

我们都听说过增强现实(AR),但是目前几乎没有机会看到该技术的实际应用。 我们知道,AR使我们能够看到虚拟元素与周围的现实世界融为一体。 例如,使用AR,我们可以看到我们房间里的虚拟沙发。 Apple现在允许我们使用手机中的相机查看添加到现实世界中的新物品。

Apple introduced ARKit, the framework for creating experiences in Augmented Reality, in iOS11. ARKit uses Visual Inertial Odometry (VIO) to map the surrounding environment. VIO blends the data provided by the camera sensor with Core Motion data. Core Motion data are collected through the accelerometer, gyroscope, pedometer, magnetometer, and barometer.

苹果在iOS11中引入了ARKit,这是用于在增强现实中创建体验的框架。 ARKit使用视觉惯性里程表(VIO)映射周围环境。 VIO将摄像机传感器提供的数据与Core Motion数据混合在一起。 Core Motion数据通过加速度计,陀螺仪,计步器,磁力计和气压计收集。

All these inputs allow the device to understand its movement within a room. With ARKit, the iPhone and iPad can analyze a scene and find the horizontal planes of a room. ARKit can locate tables and floors, and can trace and position objects at precise points.

所有这些输入使设备能够了解其在房间内的运动。 借助ARKit,iPhone和iPad可以分析场景并找到房间的水平面。 ARKit可以定位桌子和地板,并可以在精确的点上跟踪和定位对象。

ARKit also uses the room sensor to measure ambient light and apply the correct amount of light to virtual objects. ARKit is compatible with Apple’s A9, A10, and A11 processors. To develop with ARKit you can use Metal, Scenekit, and third-party tools such as Unity and Unreal Engine.

ARKit还使用室内传感器来测量环境光并将正确数量的光施加到虚拟物体上。 ARKit与Apple的A9,A10和A11处理器兼容。 要使用ARKit进行开发,您可以使用Metal,Scenekit和第三方工具,例如Unity和Unreal Engine。

Let’s now see how to create an AR application using ARKit.

现在让我们看看如何使用ARKit创建AR应用程序。

开发环境 (Development environment)

To get started we need:

首先,我们需要:

  • The release version of Unity 2017.1.0 or later. ARKit is also compatible with the Experimental VR build used for macOS VR content creation and Unity 5.x versions of Unity 5.6.2 or later.

    Unity 2017.1.0或更高版本的发行版本。 ARKit还与用于macOS VR内容创建的实验VR版本以及Unity 5.6.2或更高版本的Unity 5.x版本兼容。

  • iOS 11 or lateriOS 11或更高版本
  • XCode 9 beta or later, with iOS SDK that includes ARKit FrameworkXCode 9 beta或更高版本,带有包含ARKit Framework的iOS SDK
  • iOS that supports ARKit (iPhone 6S or later, iPad 2017 or later)支持ARKit的iOS(iPhone 6S或更高版本,iPad 2017或更高版本)

程序 (Procedure)

Start Unity. The project window will open.

启动Unity。 项目窗口将打开。

At this point, we have to create a new, empty project:

此时,我们必须创建一个新的空项目:

  1. In the window, click on New for a new project.

    在窗口中,单击“ 新建”以创建一个新项目。

  2. Write “ARKitty” in the Project name text box.

    项目名称文本框中输入“ ARKitty”。

  3. On the same window, press the Create project button.

    在同一窗口上,按创建项目按钮。

We have created our AR project!

我们已经创建了我们的AR项目!

Open the Asset Store by clicking on that tab.

通过单击该选项卡打开资产商店

Next, search within the store: write “ARKit” in the text box and click on the magnifying glass icon.

接下来,在商店中搜索:在文本框中输入“ ARKit”,然后单击放大镜图标。

Scroll through the Asset Store window until you find “Unity ARKit Plugin.” This is the plugin that integrates ARKit within Unity.

滚动浏览Asset Store窗口,直到找到“ Unity ARKit插件”。 这是将ARKit集成到Unity中的插件。

Click on Unity ARKit Plugin and scroll down to the import button and press it. Press import again to import the same project, and import once more on the plugin element window.

单击Unity ARKit插件,然后向下滚动到导入按钮,然后按一下。 再次按导入,以导入相同的项目,然后在插件元素窗口中再次导入。

Now go back to the Asset store, press the Home symbol, and write “Cute Kitten” in the search text field. Press the search symbol and import the Cute Kitten model as you just did with the ARKit plug-in.

现在返回到资产商店,按Home符号,然后在搜索文本字段中输入“ Cute Kitten”。 按下搜索符号,然后像使用ARKit插件一样导入Cute Kitten模型。

Scroll with the cursor to the import button and press it. Press import again on the plug-in element window.

用光标滚动到导入按钮,然后按它。 在插件元素窗口上再次按导入。

Search the “UnityARKitScene” scene in the UnityARKitScene folder under “Asset/Examples.”

在“资产/示例”下的UnityARKitScene文件夹中搜索“ UnityARKitScene”场景。

Drag the scene “UnityARKitScene” under Hierarchy.

将场景“ UnityARKitScene”拖到“层次结构”下。

Go to the assets and find Kitten.

转到资产并找到小猫。

Go under Model and drag “kitten” under “Hierarchy-> HitCubeParent”.

转到“ 模型 ”下,并将“小猫”拖到“层次结构-> HitCubeParent”下。

Remove HitCube and RandomCube from the scene by right-clicking and then hitting Delete. Select GeneratePlanes, ARKitControl, and click on the inspector and uncheck Tag.

右键单击然后单击Delete从场景中删除HitCube和RandomCube。 选择GeneratePlanes,ARKitControl,然后单击检查器并取消选中Tag

Go to Main Camera under CameraParent and, in Inspector, set Near to 0.01.

转到CameraParent下的Main Camera ,然后在Inspector中将Near设置为0.01。

Click the Scene tab. Click on the kitten in Hierarchy to select it. Now we see our kitten in the Scene view in three-dimensional space. Go to the asset “UnityARKitPlugin-> Plugins-> Helpers” and take the UnityARHitTestExample.cs script. Drag the script into the kitten inspector.

单击“ 场景”选项卡。 单击“ 层次结构 ”中的小猫以将其选中。 现在,我们在三维空间的“场景”视图中看到了小猫。 转到资产“ UnityARKitPlugin->插件-> Helpers”,并使用UnityARHitTestExample.cs脚本。 将脚本拖到小猫检查器中。

Drag the kitten in the Hit transform field of the “UnityARHitTestExample.cs” script.

将小猫拖到“ UnityARHitTestExample.cs”脚本的“ 命中”变换字段中。

Save the scene by selecting “File-> Save Scenes” and call it “ARKittyTest”.

通过选择“文件->保存场景”保存场景,并将其命名为“ ARKittyTest”。

Finished! It’s time to try the new application in Augmented Reality.

完蛋了! 现在是时候在增强现实中尝试新的应用程序了。

Go to the File menu and choose Build Settings. In the window that opens, under Platform, choose IOS.

转到“ 文件”菜单,然后选择“ 构建设置” 。 在打开的窗口的“ 平台”下,选择“ IOS”。

Press the Player Settings button and scroll down until you find Bundle Identifier. Here, write an identifier of the type: “com. <Your name> .arkittytest”.

按“ 播放器设置”按钮并向下滚动,直到找到“ 捆绑包标识符” 。 在这里,输入类型为“ com。 <您的名字> .arkittytest”。

Click the Build button in the Build Settings window and save the project to iOS as “ARKittyTest”.

单击“构建设置”窗口中的“构建”按钮,并将项目另存为“ ARKittyTest”到iOS。

At the end of the process, find the XCode project in the Finder named “Unity-iPhone.xcodeproj”. Double-click to open the project with XCode. In XCode, click Unity-iPhone and go to General. In the identity field, write the same Bundle Identifier inserted in Unity’s Build Settings.

在该过程的最后,在Finder中找到名为“ Unity-iPhone.xcodeproj”的XCode项目。 双击以使用XCode打开项目。 在XCode中,单击Unity-iPhone,然后转到常规 。 在标识字段中,编写插入Unity的“构建设置”中的同一捆绑包标识符。

Under Signing in the Team pull-down menu, select the registered team name.

在“ 登录 团队”下拉菜单中,选择注册的团队名称。

Select the device (iPhone / iPad) before connecting to the Mac as the target device.

在连接到Mac作为目标设备之前,先选择设备(iPhone / iPad)。

Press the XCode arrow key to “Build and Run the Current Scheme.”

按XCode箭头键以“生成并运行当前方案”。

In the end, when we frame a surface near us and tap on the phone screen, we can see our Kitten live in front of us.

最后,当我们在我们附近构筑一个表面并点击手机屏幕时,我们可以看到小猫生活在我们面前。

Mission accomplished! The following video shows the complete procedure.

任务完成! 以下视频显示了完整的过程。

Francesco Pallotta is a senior software engineer expert in software design and development. He works in the field of Space and Defense and deals with application development techniques for virtual reality and augmented reality.

Francesco Pallotta是软件设计和开发方面的高级软件工程师专家。 他从事太空和国防领域的工作,并负责虚拟现实和增强现实的应用程序开发技术

Do you want to read more about Virtual Reality, Augmented Reality and Mixed Reality? Follow me on Medium and Twitter.

您是否想了解有关虚拟现实,增强现实和混合现实的更多信息? 在Medium和Twitter上 关注我

Did you enjoy this post? Recommend it, by give it some claps. Thanks!

你喜欢这个帖子吗? 推荐一下 ,鼓掌吧。 谢谢!

翻译自: https://www.freecodecamp.org/news/how-to-make-an-augmented-reality-app-using-arkit-and-unity-ba16515a32fa/

arkit unity

arkit unity_凯蒂猫! 如何使用ARKit和Unity制作增强现实应用程序。相关推荐

  1. 用unity制作一个智能机器人程序

    使用Unity来制作智能机器人程序可以不仅仅局限于2D游戏,也可以构建3D游戏.虚拟现实和模拟环境.Unity提供了一组强大的工具,帮助你构建虚拟机器人,从而实现复杂的AI及机器人行为.它还可以提供可 ...

  2. 文档看得太迷糊?使用Unity开发增强现实/虚拟现实应用(AR/VR APP) 书籍和文档的阅读心得

    自己上手开发了两三个AR APP之后,用Unity进行AR/VR APP开发算是入了门.反思一下自己使用过的资料. 技术书籍 一开始是找比较新的技术书籍看,因为直接看文档有些难度. 对于有Unity基 ...

  3. Unity制作2D动作平台游戏视频教程

    Metroidvania工具包:打造统一的2D行动平台 流派:电子学习| MP4 |视频:h264,1280×720 |音频:AAC,48.0 KHz 语言:英语+中英文字幕(根据原英文字幕机译更准确 ...

  4. 使用Vuforia Unity构建增强现实应用

    流派:电子学习| MP4 |视频:h264,1280×720 |音频:AAC,44.1 KHz 语言:英语+中英文字幕(根据原英文字幕机译更准确)|大小解压后:1.64 GB |时长:3h 36m 专 ...

  5. Unity制作游戏中的场景

    Unity制作游戏中的场景 1.2.3  场景 在Unity中,场景(Scene)就是游戏开发者制作游戏时,所使用的游戏场景.它是一个三维空间,对应的三维坐标轴分别是X轴.Y轴和Z轴本文选自Unity ...

  6. linux怎么改程序图标,如何在Ubuntu Unity上更换应用程序图标

    这篇文章将教大家在Ubuntu Unity上修改应用程序图标,这个教程适合于Ubuntu 14.04, Ubuntu 13.10, Ubuntu 12.04 等使用Unity作为默认桌面环境的发行版. ...

  7. linux怎么改程序图标,如何在Ubuntu Unity上修改应用程序图标

    这篇文章将教大家在Ubuntu Unity上修改应用程序图标,这个教程适合于Ubuntu 14.04, Ubuntu 13.10, Ubuntu 12.04 等使用Unity作为默认桌面环境的发行版. ...

  8. unity 制作书本 翻页效果

    unity 制作书籍翻页效果 unity C# 翻书效果 2D 真实翻页 不使用插件 自制 实现思路: 将书本分为两边,一边一个翻页实现: 下图为书本的右面,以OA为分界线,△OAB是下一面的如上图的 ...

  9. Unity 制作简单的任务动画

    Unity 制作简单的任务动画 1.添加人物模型到unity 我使用的是unity store中的免费模型: https://assetstore.unity.com/packages/3d/char ...

最新文章

  1. 【转载】Linux常用命令1
  2. 为什么叫python编程-为什么建议大家学习Python编程呢?老男孩Python入门
  3. 【AI初识境】激活函数:从人工设计到自动搜索
  4. Mybatis Plus为什么提供BaseMapper和IService两个相似CRUD操作的接口?
  5. thinkphp memcache mysql_thinkphp中memcache的用法实例
  6. 教你如何看手相掌握命运!
  7. 支持海量数据的 MongoDB NoSQL
  8. 树上启发式合并 简单例题
  9. 使用durid的ConfigFilter对数据库密码加密
  10. 互联网日报 | 1月18日 星期一 | 北京超10万滴滴司机预约接种疫苗;李子柒入驻饿了么;蔚来计划2021年在海外实现销售...
  11. 智能合约从入门到精通:Solidity Assembly
  12. hdu 4681(枚举+dp)
  13. CAN笔记(21) 服务数据对象
  14. 2021年,不平凡的一年~
  15. deep|Bayes(4)
  16. kgtemp文件转mp3工具
  17. 浏览器关闭垃圾的百度热点推荐------简洁就是美
  18. 计算机做课程表教程,初学表格制作教程 初学者如何制作课程表
  19. 【结构体】结构变量的定义与初始化
  20. 我们的flowable改造(8)-----BPMN模型

热门文章

  1. 抽象方法vs虚方法 c# 1613719040
  2. django-orm框架了解
  3. mysql-数据库操作-连接-创建-删除-修改编码-查询-切换
  4. Glide-源码分析(三)
  5. Cross Entropy Loss 交叉熵损失函数公式推导
  6. crontab -e 怎么保存后退出?
  7. 分布式系统一致性协议--Paxos算法
  8. 如何构建 HBase 集群监控系统?
  9. 备份事务日志时遇到 log corruption
  10. 为你的网站加上SSL,可以使用HTTPS进行访问