Search Unity

Creating persistent reference points and scale of the objects

Discussion in 'AR' started by Aupuma, Jun 19, 2018.

  1. Aupuma

    Aupuma

    Joined:
    Feb 15, 2017
    Posts:
    42
    Hi, I have seen that this package has just been released, and I want to use this instead of native ARCore SDK for my project, but I have some questions.

    From the samples I know you can call m_SessionOrigin.Raycast to detect the point of the plane you are tapping on. I also know you can create a reference point with the method TryAttachReferencePoint(ARPlane, Pose) from ARReferencePointManager. The pose could be retrieved directly from the raycast but how do I retrieve the ARPlane?

    In my game there are multiple levels, and I want to keep a persistent reference point as the the origin position for the levels. In the first scene I want to place the origin tapping on a point of a plane. Then I need to create the anchor there, so when a level loads it changes its position to the anchor one. With ARCore I was able to keep a persistent object, with DontDestroyOnLoad(anchor.gameobject), to do the same with ARFoundation, do I need to put DontDestroyOnLoad() on the reference point, or when it is created it becomes a child of the ARSessionOrigin?

    And when I load a new level, If I need it to be in the scale of the AR Session Origin, do I need to make it a child of the trackablesParent from m_SessionOrigin?
     
  2. tdmowrer

    tdmowrer

    Joined:
    Apr 21, 2017
    Posts:
    605