What's the difference between ARAnchor and AnchorEntity?

前端 未结 1 1840
失恋的感觉
失恋的感觉 2020-12-31 20:30

I\'m currently doing some experiments with RealityKit.

I\'ve been looking at some sample code, and I\'m a bit confused about the differences between ARAnchor

相关标签:
1条回答
  • 2020-12-31 21:15

    Updated: July 11, 2020.

    ARAnchor class and AnchorEntity class were both made for the same divine purpose – to tether a 3D content to your real-world objects.

    RealityKit AnchorEntity greatly extends the capabilities of ARKit ARAnchor. The most important difference between these two is that AnchorEntity automatically tracks a real world target, but ARAnchor needs renderer(...) or session(...) instance methods to accomplish this. Also take into consideration that the collection of ARAnchors is stored in the ARSession and the collection of AnchorEntities is stored in the Scene.

    Here are hierarchical differences:


    Apple Developer documentation says:

    In RealityKit framework you use an AnchorEntity instance as the root of an entity hierarchy, and add it to the anchors collection for a Scene instance. This enables ARKit to place the anchor entity, along with all of its hierarchical descendants, into the real world. In addition to the components the anchor entity inherits from the Entity class, the anchor entity also conforms to the HasAnchoring protocol, giving it an AnchoringComponent instance.

    AnchorEntity has three building blocks:

    • Transform component (transformation matrix containing translate, rotate and scale)
    • Synchronization component (entity's synchronization data for multiuser experience)
    • Anchoring component (allows choose a type of anchor – world, body or image)


    All entities have Synchronization component that helps organise collaborative sessions.


    AnchorEntity has nine specific anchor types for nine different purposes:

    • ARAnchor
      • helps implement 9 ARKit anchors, including ARGeoAnchor and ARMeshAnchor
    • body
    • camera
    • face
    • image
    • object
    • plane
    • world
    • raycastResult


    You can simultaneously use both classes ARAnchor and AnchorEntity in your app. Or you can use just AnchorEntity class because it's all-sufficient one.

    For additional info about ARAnchor and AnchorEntity, please look at THIS POST.

    0 讨论(0)
提交回复
热议问题