arkit unity_凯蒂猫! 如何使用ARKit和Unity制作增强现实应用程序。_cumi6497的博客-程序员秘密

技术标签: unity  python  java  编程语言  大数据  

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 later

    iOS 11或更高版本
  • XCode 9 beta or later, with iOS SDK that includes ARKit Framework

    XCode 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.

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

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

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/cumi6497/article/details/108159339

智能推荐

JavaScript的历史由来及简介_泰斗贤若如的博客-程序员秘密

JavaScript的历史由来及简介前言这次写一篇对于JavaScript的简介,我们知道的编程语言有很多种,比如Java、C++、Python等等,每种编程语言都有其独具的特色,不论是语法格式还是表达形式,都能让每个程序员沉淀在知识的海洋里难以自拔。即每种编程语言都有无限的延展性,但如果我们考虑问题的时候追溯其根源,其实也不难发现每种编程语言都具有共同的初心,最直白的话就是人与计...

CentOS5 yum源_chenwb168的博客-程序员秘密

CentOS5-Base.repo# CentOS-Base.repo## The mirror system uses the connecting IP address of the client and the# update status of each mirror to pick mirrors that are updated to and# geographically ...

CH7511|LT7211|PS8625替代方案--Capstone CS5211AN 设计EDP转LVDS优势方案原理图+PCB板设计_qq1659747718的博客-程序员秘密

LT7211是一款高性能的C/DP1.2至LVDS型VR/显示芯片,对于DP1.2输入,LT7211可以配置为1、2、4通道,还支持通道交换功能。自适应均衡使其适用于长电缆应用,最大带宽可达21.6Gbps。LT7211的LVDS输出,LT7211可以配置为单端口、双端口或四端口。对于2D视频流,相同的视频流可以映射到两个分开的面板,对于3D视频格式,左侧数据可以发送到一个面板,右侧数据可以发送到另一个面板。 PS8625(DPtoLVDS)是一款Display...

Android(微信、支付宝支付)集成开发视频教程)_菜Android的博客-程序员秘密

28分钟完成(微信、支付宝)支付集成开发过程和讲解演示。B站:视频地址

SpringBoot RestTemplate GET POST请求,案例详解_springboot发送post请求_ouyangjun__的博客-程序员秘密

一)RestTemplate简介RestTemplate是HTTP客户端库提供了一个更高水平的API。主要用于Rest服务调用。RestTemplate方法:方法组 描述 getForObject 通过GET检索表示形式。 getForEntity ResponseEntity通过使用GET检索(即状态,标头和正文)。 headForHeaders 通过使用HEAD..

随便推点

最新高级流量卡官网源码附教程_流量卡前后端源码_weixin_37863729的博客-程序员秘密

介绍:文字教程:此程序适用于php5.6版本1,导入数据库sjk.sql2,进入数据库找到数据表mao_data 修改字段url为你的主域名 不要带http(如:123456.com)3,上传源码到网站根目录4,修改数据库连接信息 文件路径 /Mao/common.php (第13-17行)5,修改分站后缀信息 文件路径 /Mao/common.php (第23行)6,修改物流接口AppSecret 文件路径 /Mao/common.php (第22行)7,修改手机短信验证码接口AppSe

程序人生的四个象限和两条主线----值得一看的职业规划_人生规划主线就像_张小凡vip的博客-程序员秘密

零为什么我们要自己做职业生涯规划?记得电影《社交网络》里边,CFO同学在知道自己股权被稀释时说了一句话,“我以为那些律师是我的律师。”其实我们大多数人对HR几乎都存在类似的误解—— 你以为她是你的HR,其实她只是公司的HR。她们care的是如何编个理由用老板给的那点小钱留住一个高性价比的人才,而不是真正有助于你发展的职业路线图。昨天还含情脉脉和你讨论人生的知心姐姐明天就可能变成拿着劳动合同

undefined reference to `ANativeWindow_fromSurface'_林多的博客-程序员秘密

问题:undefined reference to `ANativeWindow_fromSurface'也就是在链接时找不到函数ANativeWindow_fromSurface的定义解决:# 编译时,没有link对应so# libandroid.so# 编译时,在依赖的动态库列表中添加即可-landroid...

CVPR文章抢先看!这5篇最有趣,不容错过!_weixin_34023863的博客-程序员秘密

欢迎来到,空气中都飘散着 “论文味” 的夏威夷。今年,国际计算机视觉与模式识别顶级会议(CVPR 2017)将于7月21日—7月26日在美国夏威夷召开。我们的记者团也特赴夏威夷,在接下来几天为大家带来一手报道。会议官方网站最新的数据显示,今年,CVPR 共收到2680有效投稿,一共有783篇论文被接收,其中有71篇获得12分钟口头报告(Oral )...

mysql单机版_单机版的mysql安装_淑飞的博客-程序员秘密

查是否安装了mysql:centos6:rpm -qa |grep mysqlcentos7:rpm -qa|grep mariadb或rpm -qa |grep mysql有老的版本可以执行命令卸载:rpm -e --nodeps mysql-libs1、设置源cat &gt; /etc/yum.repos.d/mysql-community-el7.repo&lt;[mysql57-commu...

字节码防止内存错误及提高代码质量_JustinGr的博客-程序员秘密

字节码防止内存错误及提高代码质量 作者:cherami 翻译   加入时间:2003-12-16 13:44:29  开始使用JAVAP大多Java程序员知道他们的程序通常不会被编译为本机代码而是被编译为由java虚拟机(JVM)执行的字节码格式。然而,很少有java程序员曾经看过字节码因为他们的工具不鼓励他们去看。大多Java 调试工具不允许单步执行字节码,它们要么显示源代码行,要么什么也不

推荐文章

热门文章

相关标签