Search Unity

Question Is it possible to get access to underlying ARMeshAnchor Object from ARMeshManager?

Discussion in 'AR' started by boruds, Apr 10, 2021.

  1. boruds

    boruds

    Joined:
    Aug 7, 2020
    Posts:
    28
    Hi I need to access the underlying ARMeshAnchor object that ARKit generates that I need to pass to my native objective-c plugin. Is it possible?
    I kinda want it to be like how ARPlanesChanged events gives a list of ARPlanes but then I can access the NativePtr.

    If that is not possible, is it possible to get access to the underlying ARSession's didAddAnchor callback somehow in unity
     
  2. boruds

    boruds

    Joined:
    Aug 7, 2020
    Posts:
    28
  3. boruds

    boruds

    Joined:
    Aug 7, 2020
    Posts:
    28
  4. TreyK-47

    TreyK-47

    Unity Technologies

    Joined:
    Oct 22, 2019
    Posts:
    1,822
    You can get all ARKit anchors through the native frame pointer. The mesh anchor will be included in that full list of anchors on the ARKit frame.
     
  5. boruds

    boruds

    Joined:
    Aug 7, 2020
    Posts:
    28
    Thanks @TreyK-47 I had no idea that the anchors existed in the ARFrame pointer in the anchors property. This definitely helps, but I am just curious, does this property store all active anchors during the entire ar session for that frame? For example if in the previous frames, the anchors got updated, removed or added in the session, will all those changes be reflected in the anchors property in the current frame?
     
  6. boruds

    boruds

    Joined:
    Aug 7, 2020
    Posts:
    28
    @TreyK-47 I noticed a problem, this is very unity specific, but I did this in a purely native app and it works. I am trying to access the mesh anchors from the anchors property of an ARFrame. Some of the MeshAnchors are corrupted with faces buffer data missing. I wonder why this is?
     
  7. todds_unity

    todds_unity

    Joined:
    Aug 1, 2018
    Posts:
    324
  8. Infinite_Showrooms

    Infinite_Showrooms

    Joined:
    Oct 23, 2017
    Posts:
    8
    I can't find the exact video I saw, but this asset (currently 50% off for $75 and totally worth it) also has the ability to save the mesh while you're doing a live recording:
     
    KyryloKuzyk likes this.