You are on page 1of 7
What is ARAnchor exactly? Asked 1 year, 10 months ago Active ‘ month ago Viewed 4k times Im tying to understand and use ARKit, Bu there is one thing that | cannot fully understand, ‘Apple said about ARAnchor: 10 “0 ‘A real-world postion and orientation that can be used for placing objects n an AR scene, 5 Butthats not enough. So my questions are: + What is anancnor exactly? ‘+ What are the differences between anchors and feature points? Is amncnor just part of feature points? + And how does ARKit determines its anchors? toe suit augrentedctty kt realy eed Now 29°18 315.20 seted Oot 19°18 01953 Andy Fedorot YEBq Dongkun Lee work 8 65 we BS aren 2 13 24 1 Answer rave | Oldest | Votes Updated: July 19, 2020. 26 TL:DR x you acknowledge that you have toad and understane hie Poly, Privacy Poly, an! our Torn ofS x Auunctor is an invisible null-object that can hold a 3D model at anchors position in World Space. Think of narchor just like ifs @ ‘ranstors node with local axis (you can translate, rotate an scale it) for your model. Every 3D madel has a pivot point, right? So this pivot point must meet an sekeehor Iyou do not use anchors in aause / reslitykit app, your 3D models may be carried away from where they were placed and snce. Thus, anchors are crucial elements of your AR scene. this will have influence with user experi ‘According to ARKit documentation 2017: ris a real-world position and orientation that can be used for placing objects in AR Scene. Adding an anchor to the session helps ARKIt to optimize world-tracking accuracy n the area around that anchor, so that virtual objects appear to stay in place relative to te real world. Ifa virtual abject moves, remove the corresponding anchor from the old position ane add one at the new position. Auinchor 1 a parent class forall other types of anchors existing in ARKit framework, hence all these subclasses inher from Ausncho> class but cannot use it directly in your code, | must also say that atancnor and Feature Points have nothing in common, Feature Points are rather for debugging snincho» doesn't automaticaly track a real word target. Ifyou need automation, you have to USe rendered(...) OF sesston(...) instance methods that you can calf you conformed to protocols aAscwviewelegate Of AfSessionbelegate tespectivly. ‘Hore's an image with visual representation of plane anchor. But keep in mind: by defauit, you can neither see a detected plane nor its corresponding aaetaneancror . So, if you wanna see any anchor in your scene, you have fo "visualize" i using three thin scxcylinaer primitives. renter image doscription hore In ARKit you can automatically add aninchors to your scene using different scenarios: + ARPlaneAnchor + Ifhorizontal andior vertical ptanebetection instance property is ox . ARKitis abe to add ARPlaneAnchors to the current session. Sometimes enabled plancoetection considerably increases a time required for scene understanding stage. x + This type of anchors contains information about the position and orientation of a detected image (anchor is placed at an image center) in world-tacking session, Far activation Use detectientngges instance propery. In ARKit 2.0 you can totally ‘rack up to 25 images, in ARKit 3.0 and ARKit 4.0 up to 100 images, respectively. But, in both cases, not more than just & ‘mages simultaneously. ARBodyAnchor (conforms fo atirackobte protocol) + Inthe latest release of ARKit you can enable body tracking by running your session with atbodyrrackingconfiguration() Youll get ARBodyAnchor in @ Root 2eint of CG Skeleton, or at pelvis position of tracked character, ARFaceAnchor (conforms fo attrackabte protocol + Face Anchor stores the information about the topology and pose, as well as face's expression that you can detect with a front TrueDepth camera or with regular RGB camera, When face Is detected, Face Anchor willbe attached slightly behind a nose, in the center of a face. In ARKit 2.0 you can track just one face, in ARKit 3.0 — up to 3 faces, simultaneously. In ARKit 4.0 a numberof tracked faces depends on a TrueDeptn sensor and CPU: smartphones with TrueDepth camera tracks up to 3 faces, smartphones with A‘2+ chipset, but without TrueDepth camera, can also track up to 3 faces. ARObjectAnchor + This anchors type keeps an information about 6 Degrees of Freedom (position and orientation) of a real-world 30 object dotected in a world-tracking session, Remember that you need to specify aRvererenceobject instances for detec property of session contig AREnvironmentProbeAnchor + Probe Anchor provides environmental lighting information for a specific area of space in a world-tracking session, ARKit's ‘Avia Inteligence uses it to supply reflective shaders with environmental reflections. ARParticipantAnchor + This is an indispensable anchor type for multiuser AR experiences. If you want fo employ it, use trve value for ‘ctallanorationenasles instance properly in wulttpeercannectivity framework, ARMeshAnchor + ARKit 3.5 subdlivdes the reconstructed, real-world scene surrounding the user into mesh anchors. Mesh anchors ‘constantly update their data as ARK refines its understanding ofthe real world. Although ARKit updates a mesh to reflect a ‘change in the physical environment, the mesh's subsequent change isnot intended to reflect in real time. ARGeoAnchor (conforms to serrackobLe protocol) + Im ARK 4.0% there's a geo anchor (a.k.a. location anchor) that tracks a geographic location using GPS, Apple Maps and ‘additional environment data coming from Apple servers, This type of anchor identifies a specific area in the world thatthe x There are also other regular approaches to create anchors in AR session: + Hit Testing methods + Tapping on the screen, projects a point onto a invisible detected plane, placing ARAnchor on a location where imaginary ray intersects with this plane. By the way, auseTestaessit_class and is corresponding hittesting methods for ARSCNView and ARSKView willbe deprecated in iOS 14, 50 you have to get used to @ Ray-Casting, + Ray-Casting methods + you're using ray-casting, tapping on the screen results in a projected 30 point on an invsible detected plane. But you can also perform Ray-Casting between A and B postions in 3D scene. The main diference of Ray-Casting from Hit-Testing is. that, when using the first one ARKit can keep refining the ray cast as i learns more about detected surfaces, and Ray- Casting can be 2D-t0-30 and 3D-tc-30. + Feature Points + Special yellow points that ARKit automatically generates on a high-contrast margins of real-world objects, can give you a place to put an ARAnchor on, + ARCamera’s transform + iPhone's camera's position and orientation simal tloa4x4 can be easily used as a place for ARAnchor. + Any arbitrary World Position + Place a custom ARWorldAnchor anywhere in your scene. You can generate ARKits version of Avchorentity(world(transforn: mtx)) found in RealiyKit “This code snippet shows you how to use an ARPlaneAnchor ina delegate's method: renderen(_setanaa:¢or:) fume renderan(_ renderer: ScnSceneRenderer, sianos node: semede, for anchor: ARAnehor) fvard let planeanehor = anchor a8? ARPLaneAnchor else ( return} tet grid = Getd(anehor: planetachor) res addhaehade (grid) x you acknowledge that you have toad and understane hie Poly, Privacy Poly, ant our Torn ofS x AnchorEntity According to RealityKit cocumentation 2018: snerereaesty is an anchor that tethers viral content to 8 real-world object in an AR session RealityKit framework and Realty Composer app were released in WWDC'19. They have a new class named anchorsntity . You can use AnchorEnlity as the root point of any entities’ hierarchy, and you must add it tothe Scene anchors collection. AnchorEntity automaticaly racks real world target. In RealiyKit and Reality Composer sncrarenesty is atthe top of hierarchy. This anchor is able tonhold a hundred of models and in this case its more stable than if you use 100 personal anchors for each model Let's see how it looks in @ code: fame nakeuIview{context: Context) > aRview ( tet arviow = Atvien(frane: 2870) et nodeianchor = try! Experience. losdtodel() arviea. scene. anchors-appera(nodelanchor) Peturn aview snchorentity has three components: * Anchoring component ‘+ Transform component + Synchronization component To find out the diference between skanchor and Anchartntity look at THIS POST. Hore are nine AnchorEntly's cases available in RealltyKit 2.0 for iOS. 1/ #8308 postion in the AR scene x you acknowledge that you have road and understane ko Poly, Privacy Poly, an our Torms ofS x 1/ phoned to the trocring conero fnchorentity( cane) 1 for face tracking (Sel fe Canere config) fnchorentity( #28) 11 For snage tracking config bnchorentity(-inage(group: "croup", rane: “node")) 1 for obsect tracking config hncnorentity(.coject(Eroup: "croup", mane: “obsect")) 1 far plane detection with surface classification Inenortntity(.pieve({-any], classisieation: [.seet], alninuntounds: (2.8, 2.6))) Uf sven you use ray-casting Inchoréntiey(rayeortReruie? myRayeastterslt) — /* ro dot rotation */ 17 ten you Use Mdnchor with a given ident fier Anchorentity(, anchor (Aderei¢ser: wtd)) 1) creates anchor entity on a baste of ARénchor nenorantiey(anchors antnehor) 71 ne dot natotion */ ‘And here are only two AnchorEntiy’s cases available in RealiyKit 2.0 for macOs: 1/ Boxed worl postion tn VR scone nenorentity(norta(eransforn: #!3)) 1 Conero tronsforn fncnorentity( caer) [Also i's not superfluous to say that you can use any subclass of assrenor for Anchorentsty needs: ane sesston(_ Session: aRSession, diaipaate anchors: (aBdnehor]) ivard let ‘aceanchor ~ anchors. first as? ABraceknchor anchor. adaenih(nosed) Srview seen. anchors. appené(archor) od ol 19 ot 1057 newered 08 40°83 20:20 Andy Foderatt ‘can we overide the extent propery of arplaneanchor? Is it possible to make infin pane for detected plane anchor? ~ Roshan Sade Aug 2119 at ‘Andy: Great! Where aa you fal hese sl? Is ther attra page where | can lean these thing. | quick question how to automaticaly detect a word object suppose a sutease? raja patra Jul 17 at 1218, Hi @rsjapaterya,ploase publish tas a 80 question, PS, 1koop all that stun my head), AL the moment there's nat many great faring esovtees. ‘Tats because ARK is too young. By tne way, ry fo read raynendertich's ARKH book. ~ Andy Fedora Jl Wat 12:28 7) nd our Cooke Policy, Privacy Policy, and our Terms of Service.

You might also like