Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

AR Foundation....how to use ARReferencePointManager.

Discussion in 'AR' started by AlbyDj90, Feb 18, 2019.

  1. AlbyDj90

    AlbyDj90

    Joined:
    Feb 7, 2015
    Posts:
    35
    Greetings,
    i need an help to undestand this. I see the ARReferencePointManager in the components of Ar Foundation.
    How to use this? I have to manually set an ARReferencePoint or is something that Foundation do by itself? This help to improve tracking ability? I see this Tutorial but even the guy that makes this video could not elaborate exactly how to use this component...



    I have to put any object as a child of the Anchor created by the Reference Point Manager?
    I ask this because i need a good tracking performance for my apps, and i have always a little bit of jitter and bad or lossy tracking...
    Thanks for any response
     
    Last edited: Feb 19, 2019
  2. AlbyDj90

    AlbyDj90

    Joined:
    Feb 7, 2015
    Posts:
    35
    I figured out how to use it:
    I use ArReferencePointManager.TryAttachReferencePoint for create a Reference Point attached to the virtual floor.
    Then i put any gameobject i instantiateas a child of this gameobject. The Tracking is improved a lot!!!
     
  3. KrikeyAdmin

    KrikeyAdmin

    Joined:
    Feb 5, 2018
    Posts:
    29
    I've also been trying to understand how to use Reference Points..... If ARFoundation has found a ground plane, and I've attached my game objects as a child of this ground plane, is that the same thing as if I were to manually create a Reference Point to attach my objects to?
     
  4. AlbyDj90

    AlbyDj90

    Joined:
    Feb 7, 2015
    Posts:
    35
    Good question!
    I serch everywhere for solution about this topic...even the official course by Unity on Coursera don't show the use of the reference point :(
     
  5. coder89

    coder89

    Joined:
    Oct 26, 2018
    Posts:
    29
    Does anyone have a clue about this? The documentation is very limited around this. Could someone from Unity team explain what is the difference between attaching child object directly to the ARPlane vs adding reference point for this ARPlane and adding children under that ref point instead?

    Thanks!
     
  6. GreeneMachine

    GreeneMachine

    Joined:
    Jul 3, 2015
    Posts:
    126
  7. kittik

    kittik

    Joined:
    Mar 6, 2015
    Posts:
    565
    Does anyone have a definite way to make tracking better? Even when using MakeContentAppearAt(), my created objects are floating around a little bit.
     
  8. Edisyo

    Edisyo

    Joined:
    Dec 11, 2017
    Posts:
    9
    where / how do you get the reference point ( the one you make a children )? Because for arReferencePointManager.addReferencePoint method, it takes Pose. And I can't figure out how to link a referencePoint i made in script with that pose i passed to addReferncePoint method.
     
  9. Tarrag

    Tarrag

    Joined:
    Nov 7, 2016
    Posts:
    215
    hey @Edisyo Can try with this, hope it helps, cheers

    TrackableId trackableTypeHit_ID = s_Hits[0].trackableId;

    m_TrackableTypeHit = c_ARPlaneManager.GetPlane(trackableTypeHit_ID);

    ARReferencePoint thisRefPoint = c_ARRefPointManager.AttachReferencePoint(m_TrackableTypeHit, hitPose);
     
    Edisyo likes this.
  10. Edisyo

    Edisyo

    Joined:
    Dec 11, 2017
    Posts:
    9
    Thanks, thats a good advice. But i forgot to mention that I use Image Tracking, sorry :/ therefore I dont use planeManager.

    Code (CSharp):
    1.  
    2.                
    3.                 pos = cannon.transform.position; //same position and rotation as trackedImage
    4.                 rot = cannon.transform.rotation;
    5.                 Pose pose = new Pose(pos, rot);
    6.                 refPoint = aRReferencePointManager.AddReferencePoint(pose);
    7.                 refPoint.transform.position = new Vector3(pos.x - 2, pos.y + yValueChange, pos.z + 50);
    8.  
    9.                 foreach (Boat go in battleshipsGameScript.spawnedBoatList)//each boat added as child of refpoint
    10.                 {
    11.                     //go.gameObject.transform.SetParent(refPoint.transform);
    12.                     //go.gameObject.transform.localPosition = new Vector3(0f, 0f, 0f);
    13.                 }
    14.  
    15.                 battleshipsGameScript.spawnPoints[0].transform.SetParent(refPoint.transform);
    16.                 battleshipsGameScript.spawnPoints[1].transform.SetParent(refPoint.transform);
    17.  
    I get the referencePoint working, but it still follows camera movements. And when I enable commented script, the objects spawn in cameras position. Is this the correct way to use referencePoint for ImageTracking?
     
  11. roshan_unity825

    roshan_unity825

    Joined:
    Jun 14, 2019
    Posts:
    4
    Hi,I'm trying to figure out the same problem. did you solve it by any chance??
     
  12. Edisyo

    Edisyo

    Joined:
    Dec 11, 2017
    Posts:
    9
    Nope, got rid of reference points. :/ they didn't work or I just couldn't get them to work.
     
  13. unitynoob24

    unitynoob24

    Joined:
    Dec 27, 2014
    Posts:
    398
    Bump, sorry for the necro, I am also trying to distinguish the difference between placing an object on a plane and setting its position and rotation from the hit[0].pose (which seems prone to sliding around a bit) - vs reference points? Reference points sound much more robust, but they also sound like they are performance heavy. That is all I could really find on them. Any more insight would be greatly appreciated.
     
    Last edited: Nov 14, 2019
    unnanego likes this.
  14. nativ18

    nativ18

    Joined:
    Mar 6, 2019
    Posts:
    1
    Hi guys, I think that I have the answers for you all.
    My background is native ARKit developer so I think I know what stands behind reference points.
    First of all - reference points are basically ARKit ARAnchor objects, it means that the session is trying to learn the environment around them for better relocalization. On the contrary when you just add game object the session doesn't learn then environment and that's why you experiencing jittering and floating.
    Apart from it, Reference points are also being stored in the WorldMap for persistence and multi-players AR sessions(again similar to native ARAnchors).
     
    Scrapemist and DrSharky like this.