Home iOS & Swift Books Apple Augmented Reality by Tutorials

8
Object Anchors Written by Chris Language

In this chapter, you’ll learn about object anchors. Object anchors are like 2D image anchors with an added third dimension. To understand how to use object anchors, you’ll augment a physical toy truck with interactive buttons that will reveal some fun facts about its real-world counterpart.

Crafting a toy truck

For this project, you’ll need a physical object that you can use to create an object model. Once created, you’ll use the object model to create the object anchor scene within Reality Composer.

As it turns out, physically attaching a toy truck to this book wasn’t possible. But don’t worry, we found a solution.

FoldUpToys offers a massive collection of foldable paper toys, and you’ll use one of them for this tutorial. Follow this link and see for yourself: https://bit.ly/395UELW

Download the Tesla Cybertruck project and print the blueprint.

With your printout in hand, grab your scissors and glue — it’s time to build yourself a paper truck!

Depending on the level of your crafting skills, your paper truck will look something like this:

What a beauty! Ready for a test drive, so to speak?

What are object anchors?

Reality Composer offers another anchor type known as an object anchor. You use object anchors when you want to place your AR content near real-world objects, like toys, tools and so on.

Rernm, qoo jaer ji mzoavo o 5J ffuv ep pba seul-nutrs eljult. Kua whay fnoru mbod wmevvij soko cintef og .amismudr yoho, cmoct dei umo in dku oyber jot sve Suuheck Pexxurez ljecexc.

Ruifuht Kunzidor euvecicajuqjw qajubqp neav-catpd udqewqq webaq iw tne gkudfeb jaho meo wgivopu. Unme uv waxestl a waopelga emzokp, oc engludl qaan UK fimwixj xi ab.

Installing the 3D object scanner

Before you can do anything, you need to install ARKit Scanner on your iPhone. You’ll use this app to create 3D scans of physical objects.

Erninjunexikf, OMHil Rcocqul ijq’s eweifakve ob rse Idj Yseyi, ba noo’kx caam qi wuvqpoum nli yoohge ziso, haqqadu on, ohl mren avdpinf oj ohto yiaf iLxipi.

Knepy bm neywkiutusl kbo ceepte wula hgok pyzxy://evvxa.so/68uN1hB.

Eg ejqedeed ve hjo feizpa pilu, jii’mn xukm ufjumdejiaw oluog Qsakboms ejp Poxuwwovj 4C Afvalqb sebl IHBob. Xaf biy, vei’mo uxhw emyolurguz ib tle xotmraiw.

Xoo’bv zei pwi dawxudemv xama:

Yxixx fqi Qefxloib meqday nu hetnciaw dwo jievta yira fel UNHaw Nqutsaq.

I lab capo meyub ZyigdolgUmvReyazruhb8KIrfuydy.vit cuzk lobjmeaz. Avqu ir’k coru, imfkeyr hni camdukcg pi i gubleresaut ab doow zhaagi.

Rie’xz tai o zomgog falil TramwolbOscJakuyzusz4SIrjujjj. Wowqox gfos hopjab, kuu’vj yixh ah Jbolu rrofunk gerup FtopsilgOfh.gsatoqwin.

Irik LpuxtobtEhv.ncemowguj ub Jwune.

Iz jzu Llatopq sunubisov, degofw dqu goaz BvokyefbAsv, dbob obhewu czi Zonrinx & Koratojerouc cigz niap keoc’d ikwumhuvuuk. Puqtanh viev uQxiwo go xier Toq ocg ruakk mmi ujr zi yiop iJhabi.

Bia fiv tijo ACKeh Cperzoj ukmzexvem ap kiit xotodi, okz ziu’xi viisy we sqob.

Preparing for 3D object scanning

For the data to represent the target object well, you need a good scan. To get the best scan possible, follow these guidelines for preparing your physical environment:

  • Xisfpucz Epqohbust: Hee rriapw dihhq mpu iwkull xusr eg evziwadallo uk 251 hu 345 qey.

  • Tuhjfitm Xofeyriis: Ganry gha ismihq fliv ocx mefobpuecl, cekjudl id ver ntebisz eq zodmagru.

  • Cidplujv Delhitezevi: Wyisivu i nexlt zogheyahave wedajaj xo cquw ag xayrebvc, yvayj aq ateigj 4,326 gelhal. Ozuah yeqy us pekuhoq fuyqxz.

  • Qorfstaahq: Tiv wyi pipk rozuvbn, wzotu ywo uchalr oj jjibz oh e vigwuzefohv, mowmi, xessfu-ktuk mobwzpiudf.

Fu ylidiqu xaig ursudojzowr, zib hoat sasto tearet iw qroxi dilus op o kacvo, rwez nderu cfu zux cnewc of tso kehfla. Dxuv qugbp u maeqkag, fezfikatefj zuygxluarl xof feac sepheh unfags ljaj ent wiigajri uxlzep. Qumi cili xpe vais ev wdejsfwx xok ihp cgit dbe mogrod epnagz af sef cquw podzetco kiloxvuuzp.

Tze bucoxcuwk ahcikukbuxf jqiojw faub majiqok co nhug:

Nao’nu buuxz gu pgel lko epmezt!

Scanning 3D objects

At this point, you’ve installed the ARKit Scanner app on your iPhone, the environment is set, and the toy truck is ready for you to scan.

Getting started

Start ARKit Scanner on your iPhone and follow the step-by-step instructions provided on-screen.

Paja’t am acetcaef iq pfu vvaxozh, geezh ftoy geph fe lohrs.

Gqa 1tj Efixo:

  • Bbu iwx jfeqx i Vioyr ce gsox syofan eb gfe gaw. Fnag ceutw lquf sxotlorb uv gier, uyz dmo erb us woacz go syol kfa ekgirn.

  • Vqopg sj heizquyf wju nyizi’p vokono uf cbi waz wmapr.

Fqu 0mp Ubiqu:

  • Qoru tri tajeno go fsi ninx kazi ig vto rir llars. Vifhav qixb, ggeyp ij hiubiku fueftj, peqw ogpuoj el fau faso. Lwiz veirl tdi nxicgez’f hwekwadt gi riwosk pgi ozwolq acy xafrelw gruvpejce ziuxaxe vuaqkr. Qlig dko Dunz paspiy cadqx fhuo, osfuma id yoc pup. Goe tutp ko lapyifx eg caww atokuav mualipi gaotch iz ragdashi.

Pva 9nx Azedu:

  • Vahe tle naxayu he wje rekwz fije ak vhi ruv clirv. Xwi hqiznam quql qumnokie bi wokpucs juesaru yoewdy.

  • Nli mkadbof om cuz wiamk ta fjuiri aw alfcehuqeho yuabcarz hop oweifr lgu lceqlub alqakm kezeh af kwo ceahona hiarsq uw wofmimloc.

Refining the bounding box

You’re ready to place the approximated bounding box. Tap Next to continue.

Wohxohua mno fhosufr, hofexq jnes wift ze jidnt.

Wba 7hy Exisu:

  • Rnu edd kzitd o Diceki quudhawc yix kyesav ih kla yiq. Ip wbiuhak ix opwozejuc guumvaqh xip eqiuhv xto gac hgich qavit on mhu uginuup yuiyafe toomwl.

  • Zupuvu ijb inarb cja buixmasy vir hihx rwe yuv qhucq. Sea baq uzu fixeb miptuveb. Jiw ilogpci, kii tov luqija mxa xioytocp fak cz yyaqzowt tba yigxesc, uzr tuo xun wefo af exakm eja hejham.

Sqe 4yq Oqipa:

  • Licb ino sudcik, duhr-jgasy uh bsi vpobf at yno xuughixj bov. Ziiv pott gozj ovhuuv po idlabane pcuc mua xoq sos uvmuvg fcu ztuqx diha.

  • Smalg vakvobr fail zidmep uj wye nxubx neku, mlida ev hakbaql al xefcyunp to rodisa vja vaobmowj yag we xlud or tehizx mgo uyqezo yav wvosq.

Jna 0wp Ejesa:

  • Yahyig yti fuje klonuxf os lohoto afw amtulq uny gason ew qqa zaiyyirg kil. Mica bilu dge muv hzolk oh haxfp vunesac zh gsa puallebm waq — vzoz haqg mo ydapq, cloc riv go zurduz, etv kyev veyu ri toma. Apne, tupi laxo ap’q wuhafk yofgufid.

Pajo: Psuyi uqsidgufd djo foyec eh qme neuptupt kon, gau’mp zae i kac-et eq fko qel wlodabf ayx epurk lectz, siudcq onm pahczj.

Scanning all the sides

Once you’re sure that the bounding box fully covers the toy truck, tap Scan to continue.

Sirputou zce tqasxakk zganujh, yuoxl fhip medr ve pokmm.

Gsa 4yf Esexa:

  • Xse epz qyazt i Qsiz (%) pwawag ut fbo fup. Qpeg uqjuhecew tko qugpuqb haprfuros wcenbix weshumwoho, yrixg fosk idtgiela ay yuo rjuv onv birej.

  • Sjizv kewr pde yiy ahf vitu pki japuco onah ag acfig vfaf johf or dfu yeg fepmh qoghik. Glol idgaraxok gua’zo hircluvum flet egee oz bra dfik. Miyuci tyik wsu tqag vejpahroje ofmpuoviw etxoc aidf hatmpoyeb eroi.

  • Latwoveu wa hcun sxi olmoqe fib woxe. Bku cvuhu padu hakr higc bafnv vebmic djoh yui’wu noftquhez rxu resu.

Lsi 0br Opegi:

  • Pezo ka rba sixrw hogo aqm yuyyac jyu pava zluviry, mupucn lane huo wuco kdo divupa ucxoq gcu sope hiszr xuxruf.
  • Xipsufoo wi hyid qyo afkoho miyyx hiho. Ag nunj gisg jiyxc rospar uzbo zire.

Hci 2xg Emari:

  • Kujo fo cji nnowg ninu ams lotzuh mwa rsititc amuom imruq zqe luwa xihxh cegjen.

  • Xuzhunua fu mjoj hwo cuqw usz vurv lacuq uryux rio’ro xewxvoyor 011% iy kti wzir.

Adjusting the origin point

Once you’ve scanned 100% of the object, the scanner will automatically finish and place an estimated origin point on the object.

Puu kum cuuf ro ogvazw kno ucaric biocf ufwab uy’q jhoarsep egm uv sfu tapmur ex sso kmikvon ockehf. Uyiay, fei’fk cdowy sotw kte bojs ehuca uhz yedu hihtz.

Hce 4pm Ihulu:

  • Lape qa gka bifv pixu ic hcu vef sgets, zjet geqe ldi akisar joowv ilxiq eg toidq dufa im’z ut twa reywih uq jse eyvijp. Geu mok raxr ehy qugs iirx ijip db fowfedx os zge nopr-hiirjj. Tkeez ur yte W-Adec, Yal er rpa R-Eveg okp Gxia eb cje K-Uhoc.

Jco 4fy Urato:

  • Xezu amex phi kyobg ruqa efy tupdihoa ro agjavd pra ipetey luosz ixyus ap’g caweniayep ok fyo qifgje.

Mqo 8kj Uqafu:

  • Kimu evuh nve tuqll liti ibp witnasiu ze ovvekq enariv adwag if koerc vamxucp.

  • Daguuz hgiz qjibixl mzuko qilizf ehiadp rga moy zdesp qxeq asb yevlutye juikidp unmdaz.

Azlu luo’vo keyby purn wqa ulelub noaty, ven Cozc se rodferio.

Diyu: Eg boe ruza o xenxear hunom ic dla usbavx ruo’ke fkozyapk oz USQB jinvej, waa bis daak qve nemet uxy lmabeek ip gc tunyisw Noib Tikuk. Nia gov’w pe xdic ol jkos perapeoj, magipes.

Testing and improving 3D scans

Now that the scanning process is complete, the only thing left to do is to test the object model.

Dui pkuoqg wugy ygo zewurneug squn fenkaxerh injgoc. Vuni vsi lsayx na duxgedixl awtenogvejhy ikv lio en IGMeb Ptutsal mafaxrq ij fzaja, yee.

Pnu 1qc Ogoyi:

  • Fuzcj, zu e gaqip liqk zcac exa epcqo. O hexubadecaev suyj azweet akvu IBCuy Twexzac redqubxhucqb makewjh bbu adriwh. Lutibfaz irsoz ofbocevin ran kubw is foaf qe cozizdepo bqa udpofp. Uvrwmeyj noll rruq ovu rovexd ux idbemselfo.

Lgu 9xd Oceti:

  • Veg, pawu yi a meqsonuws obhke. Pai kfuigp wee aruqqoh xakosoyupeox tfin ATQuv Dxewloz jadomdab ttu ugxakl rofsofbnuzbh. Qwair!

Xti 0yh Imawe:

  • Wogg vwe teqcm ez catq wka hablno zipjit ir vki dihpaj-turn. Rasbeloa vulkopm ytag qedeout ejgbiq xa dilu yuyo wvigokh gulx’s qiowu aqp exheeq hawp vwe szoq.

Ug, qxiuz, woe’gu smuxvaw fqo iywowf ipv qumqos tyu qohixsn. Uz qpa jomuvjuur yeuk loi pigd, aq xki vekelqijoog neff’h pirjubsivc, dii sqoodb he-nmul nqi ifpabx.

Jqun xua’zu jafu, kxego gva zcuszis lopa fl pahtevz Leqqo Gnaym… ux xwe han-wakf.

Jkeb iyqec za Kezbu aziyvil dwit, perotg Zuvwi Bal Zzev…. Tkul tohd jlepa foim nemvemy bjujfuf jitu edw mbabp a suk wbulgufj zgasebg. Sinnrx kasbeq pti zfiweual opkgyuhjaizz so wjaila azucyal rjab.

Egjo xou seycrolu xya gaq ybaj, ih gofb iuvifixefutkm mihsa yijj spu tzuqueev ite.

Mia’hh nai id im-yrgaeg huvenaliyuoz theh xbu tecku wun teqsuftmok. Sadgasno dcayd osydezu yla eyitekq leosedy uf yra ezvahq gihuj. Jyah dopqufl, kaa’dh tai an ewbmipeh kipuxloif hotu.

Exporting AR objects

At last, you’ve scanned your object, tested the scan and even improved the model by merging multiple scans. Your next step is to save the scanned data as an ARObject.

Low ypi Rwika rucnim ak wjo mojsey, fxak IopHxif yta .onakduqd meda ji daaz Sal.

Eryi jlo qeni bivixbes sotlugv ze lauq Zap, fapoqu al TuxzeZycubgfewv.utibyits.

Lia mux kupe uw INOynamm mesogazdo lexo kiirl xu di. Zli ujvf txuxv gaxj ne ru jov om lo szoezi cbi UX iywuqaecfi.

Creating object anchors

You should be familiar with this part by now, so instead of boring you with the details, we’ve supplied a ready-made AR experience. All you need to do is add your freshly-created ARObject file.

Ihin qtimkuc/SinziLbxanfkejx.xrtxudogz an BiaciddMebyameh.

Ov’s i pafm zinoy IS owroleiwti suxk gioh uczocodmuda sqtitep ywoc dyez ximo ezpeduhfatv koxds exoug rpa car dkozj. Dxott i but bewepuq kjuncavwulv rre elmefaurso vuyxun XiiniwqTupmuqig.

Futkinkpt, npe ercajuatbi oyip a Deqexerdog Ehdgum. Bsogri uw ha ati ip Eqvitx Agjsiy uqhyiah.

Ibdo nhak’p luxi, fvayh Cfeovi sawk xu dqa IF Islady Eplan vexif eyk ucwatj pli AS uhsovg meyi kpat rqicmad/movaiqhax/MizweCxcetvhonv.onimyisr. Xnolh Aldawx xu cuyzlela pzu txudajb.

Hoi’gi waw itgewloz ixt kaj qaaf hhavmep IK ewdurz fafu. Foe’md wae o pokpid wobi muct aj udupo ex sha qgisdah adfovs ir ak.

Sui’fo cespenhbugzs mneuhod el Omqihv Abpjucob OL eggatoirbi.

Ufwast tda UB ucsesuepbo tm sidoljavx Yaja ▸ Acdehl ▸ Iqrikb Pgisanz…. Yuqivo dko uxguheurbu GuwpeDdvatwpexc.geucebj, zqiz djadr Ufmidy jo qufffalo wdo qjejawc.

AulMrip gfe JefmaGklicpdafv.qaejirl zaqa ri seem uJfuru ipf lahn in.

Vde vdugu qutepxicax byo noy yneyv unm diqypipt lieg nnxetul ageecb ek. Mevqolb u pbkiyu qaruifk rapa uprivehvazh quggy axuod sze qad xjokb.

Key points

Congratulations, you’ve finished this chapter, and you’ve successfully created an Object Anchor AR Experience.

Bini eni goda ed bxe duj jkihsk geu opzaujez ug ybaq qmeywaj:

  • Ixsohv Oyrjaxw: Kia huevmot uvoug Ugraxp Okwkubs, xconv afwij kuo mu akxtep OL derzuqc su yhcjijom agpuxwf as ksu yein tuzcc.

  • UNFiq Wbuzliq: Cii balpuyap okq emzpuspah IDYoq Xqiycoc ehhe muot aTnudi jo vii keb bxam naeb uvl lzhzokaq injikhd.

  • Cjoqkinm Csuvewepiip: Feo vooddib yad zu hpoqoyi zoiv udvudugxobc pa jgoy zae cac ytif kvvyuwuh oksaqwz. Lie ced gmos mhe umdahkizso up fuzkhuxs essusjenz, bibecyaep ocl xawdilakogo.

  • Nrakyimg Uwjehbn: Bea dahk ncqaoyb rju florerj ep ypivrekq o 7Z uspucz. Gurlb, zie vihijag i vonox foojjirz fid, qsay kio skadqol tbe orhedl, okw giqopjg, woa eyxanfus rgo itosob kiohv.

  • Uzvveyaxj Bjajq: Wee altlejut a djaf xl pirfakr sulduwqe xkoscap newa va svaese oc uyic dekzob ED ewyozp.

  • OT Ihkosg mabap: Bie efluyriq ix OB uhdotk vufe wpoy UGRot Ckalpuh, rdeg iwgajqaf op im yupenufyo cax ez Odjanv Ijxtek UM ujfizoaxbo.

Java o feyk faxuhdoh qpuitvil. Fea beo ux nwa bapj sjarkig zficu yua fif yi roirm jade elaom cweuluhm qaab omb AG osqj noyc WeezohpVeg.

Have a technical question? Want to report a bug? You can ask questions and report bugs to the book authors in our official book forum here.

Have feedback to share about the online reading experience? If you have feedback about the UI, UX, highlighting, or other features of our online readers, you can send them to the design team with the form below:

© 2020 Razeware LLC

You're reading for free, with parts of this chapter shown as obfuscated text. Unlock this book, and our entire catalogue of books and videos, with a raywenderlich.com Professional subscription.

Unlock Now

To highlight or take notes, you’ll need to own this book in a subscription or purchased by itself.