Search Unity

ARSessionOrigin scale clarifications

Discussion in 'AR' started by rxmarccall, Jul 16, 2018.

  1. rxmarccall

    rxmarccall

    Joined:
    Oct 13, 2011
    Posts:
    353
    According to the single page documentation, if we adjust the transform's scale of the ARSessionOrigin object that will change the scale of our AR sessions tracking data. (IS this also supposed to scale the sizing of any objects we spawn into the Unity Space?) The issue I'm finding is when I set the scale to 10 on each axis for example, the demo trackables such as the cloud data points isn't matching what I see on the camera. Is this intended behavior? If so, for what reason would you ever want to change the scale of the ARSessionOrigin?

    I've noticed that the prefabs I spawn into the world are HUGE compared to in the editor, so I thought I should maybe adjust the ARSessionOrigin scale, but it's looking like that doesn't have an effect on the actual objects we spawn in the world?

    Also, is it correct that if I spawn a prefab that I should have it's parent be the ARSession's trackablesParent transform?

    Code (CSharp):
    1.  
    2. void ARSubsystemManager_PlaneAdded(UnityEngine.Experimental.XR.PlaneAddedEventArgs obj)
    3. {
    4.         var go = Instantiate(SpawnOnTouchObject, obj.Plane.Center, Quaternion.identity);
    5.         go.transform.SetParent(SessionOrigin.trackablesParent, false);
    6.  }
    7.  
    8.  
     
  2. rxmarccall

    rxmarccall

    Joined:
    Oct 13, 2011
    Posts:
    353
    I found this github post where it sounds like I shouldn't be nesting spawned objects under the "trackablesParent". When doing this, and changing ARSessionOrigin's transform scale, it does indeed seem to have effect on the scale of my spawned objects, but also my spawned object's position now no longer seems to correlate with the trackables such as a plane trackable's Center position.