by Harini Janakiraman
通过哈里尼·贾纳基拉曼
Augmented Reality. The future screams of it. The present is full of it: filters, games, and AR apps are popping up daily. Imagine a world where everywhere you look there are visual data aids to augment your comprehension.
增强现实。 未来的尖叫声。 现在充满了它:过滤器,游戏和AR应用程序每天都在弹出。 想象一个世界,到处可见,都有可视数据帮助您增强理解力。
Now, I would rather go all in on VR, especially after seeing Ready Player One. Oh how I wish I could be transported to Oasis right now! However, AR has more real world use cases from furniture shopping to building industrial factories — the possibilities are endless.
现在,我宁愿全神贯注于VR,尤其是在看到Ready Player One之后。 哦,我多么希望我现在能被运送到Oasis! 但是,从家具购物到建造工业工厂 ,AR在现实世界中都有更多用例-可能性无穷无尽。
Augmented reality will be an essential part of your daily life. It will change everything.— Tim Cook
增强现实将是您日常生活的重要组成部分。 它将改变一切。
Now, these claims have to hold the test of time (powerful use cases, realistic visuals, processing speed of hardware, and so on). Until then, Mobile AR is possibly the test bed for developers, before a headset or something similar is part of your everyday tech, along with a community of AR developers and a bevy apps.
现在,这些声明必须经受时间的考验(强大的用例,逼真的视觉效果,硬件的处理速度等)。 在此之前,移动AR可能是开发人员的试验台,而在日常应用中,头戴式耳机或类似设备以及AR开发人员社区和一些笨拙的应用程序已经成为移动AR的一部分。
Today we will be using Apple’s ARKit (which has made AR dev so much easier to explore) to get our feet wet and experiment with AR. We will build a basic superimposing object app in “additive” AR style to the camera view. To make things interesting, we will be placing Harry Potter PortKeys as our AR objects, which will transport you to fantasy land (this part is left to your imagination for now. I will be building a more comprehensive version of the app in the next part of this AR series, so stay tuned!).
今天,我们将使用苹果公司的ARKit(使AR开发人员更容易探索)来弄湿我们的脚并尝试使用AR。 我们将在相机视图中构建“叠加” AR风格的基本叠加对象应用程序。 为了使事情变得有趣,我们将把“哈利·波特PortKeys”作为我们的AR对象,它将把您带到幻想的世界(这部分现在还留给您想象。在下一部分中,我将构建该应用程序的更全面版本这个AR系列,敬请期待!)
(For muggles, here is the definition *wink wink*):
(对于麻瓜,这是* wink wink *的定义):
A Portkey, in Harry Potter world, is an enchanted object which, when touched, will instantly transport a person from point A to point B. The object is usually a worthless piece of junk and is randomly placed around so as not to attract attention.
在哈利·波特世界中,Portkey是一种附魔物品,一旦被碰到,便会立即将一个人从A点运送到B点。该物品通常是一文不值的垃圾,随机地摆放在周围,以免引起注意。
In this tutorial, you’ll learn to build a Unity app with ARKit. We’ll add an augmented reality layer featuring Harry Potter PortKeys. Most of the time you spend will be on installations, so grab your coffee and get ready!
在本教程中,您将学习使用ARKit构建Unity应用。 我们将添加一个带有哈利波特PortKeys的增强现实层。 您大部分时间都花在安装上,所以请喝杯咖啡做好准备!
In case you don’t have it already, download and install the latest version of Xcode for your Mac and Unity.
如果尚未安装,请为Mac和Unity下载并安装最新版本的Xcode 。
Install the personal free version of Unity, but make sure “iOS build Support” is checked.
安装Unity的个人免费版本,但请确保已选中“ iOS build Support”。
You will also need a iOS developer account and iPhone, preferably, to take the AR app you build out for a spin.
您还需要一个iOS开发者帐户和一个iPhone,最好是将您构建的AR应用程序带走。
Create a new 3D project called “ARHarryPotterApp”.
创建一个名为“ ARHarryPotterApp”的新3D项目。
Once the project is created, from the “Asset Store” tab, download ARKit into your project.
创建项目后,从“资产存储”选项卡中,将ARKit下载到您的项目中。
Let’s start off with an example scene that comes packaged with the downloaded ARKit asset. Navigate to the example scene on the left panel and double click open “UnityARKitScene”.
让我们从下载的ARKit资产附带的示例场景开始。 导航到左侧面板上的示例场景,然后双击打开“ UnityARKitScene”。
This will open up a basic cube asset placed in the “Scene” tab, which is your field of view. The “HitCube” asset here can easily to be replaced with any asset of your choice to create your own unique augmented reality scene.
这将打开放置在“场景”选项卡中的基本多维数据集资产,这是您的视野。 此处的“ HitCube”资产可以轻松地替换为您选择的任何资产,以创建自己独特的增强现实场景。
There are several properties of each asset shown on the Inspector panel on the right, such as shadow/lighting/rending and so on. We will not go into detail about these properties here (but I’ll discuss them more in an upcoming post).
右侧“检查器”面板上显示的每种资产都有多个属性,例如阴影/照明/渲染等。 我们将不在这里详细介绍这些属性(但我将在以后的文章中对其进行更多讨论)。
You need to watch out for two things here in the example. They’ll need to be repeated for any new asset added to the scene:
在示例中,您需要注意两件事。 对于添加到场景中的任何新资产,都需要重复这些操作:
Make sure you complete these two steps for any new asset added to the scene, as this helps place the object in the horizontal plane.
确保对添加到场景中的任何新资产完成这两个步骤,因为这有助于将对象放置在水平面中。
For our app, we will place random Harry Potter PortKeys in the scene from the free “Halloween Pack” downloaded from the asset store.
对于我们的应用程序,我们将从资产商店下载的免费“万圣节包”中随机放置“哈利波特” PortKeys。
Place the assets that you fancy in the scene and make sure you add the components “Unity AR Hit Test Example” and “Hit Transform” to each of these assets as shown below.
将您喜欢的资产放在场景中,并确保将组件“ Unity AR Hit Test Example”和“ Hit Transform”添加到这些资产中,如下所示。
Finally, now it’s time to build the app. Select File -> Build Settings. Check “Unity ARKitScene” and select iOS platform, and then click “Switch Platform”. This will import assets and setup the stage.
最后,现在该构建应用程序了。 选择文件->构建设置。 选中“ Unity ARKitScene”并选择iOS平台,然后单击“切换平台”。 这将导入资产并设置阶段。
You can then click player settings and check the inspector to make sure “Target device”, “Target min iOS version”, and “sdk” are all set up as you want through your system settings.
然后,您可以单击播放器设置并检查检查器,以确保通过系统设置根据需要设置了“目标设备”,“目标iOS最低版本”和“ sdk”。
At this point, you are ready to “Build” the app and select your destination directory…this could take a while.
此时,您可以“构建”应用程序并选择目标目录了,这可能需要一段时间。
Once the build is complete, open the xcodeproj from the destination folder of the build. Connect your iPhone (with compatible iOS and xcode versions), sign the project to your Team (you will need an iOS dev account), and launch the app.
构建完成后,从构建的目标文件夹中打开xcodeproj。 连接您的iPhone(具有兼容的iOS和xcode版本),将项目签名到您的团队(您将需要一个iOS开发帐户),然后启动该应用程序。
Violà, your very first AR app is ready! Look around in the field of view, spot the Harry Potter PortKeys, and be transported away to a magical land ;)
Violà,您的第一个AR应用程序已准备就绪! 在视野中环顾四周,发现哈利波特PortKeys,然后被运送到神奇的土地;)
If you enjoyed this, please clap ? so others can see it as well! Follow me on Twitter @HariniLabs or Medium to get the latest updates on other stories or just to say Hi :)
如果喜欢这个,请鼓掌吗? S 0其他人可以看到它的! 在Twitter上关注我@ H ariniLabs或Medium,以获取其他故事的最新更新,或者只是打个招呼:)
PS: Sign up for my newsletter here to be the first to get fresh new content and it’s filled with a dose of inspiration from the world of #WomenInTech and yes men can signup too!
PS: 在这里注册我的新闻通讯是第一个获得新鲜内容的新闻,它充满了#WomenInTech世界的启发 ,是的,男性也可以注册!