Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Resolved Adding an ARAnchor to a GameObject which has an AREnvironmentProbe causes position conflict

Discussion in 'AR' started by joensa, Nov 27, 2023.

  1. joensa

    joensa

    Joined:
    Jul 6, 2023
    Posts:
    15
    [Tested on iOS - Unity 2022.3.13, AR Foundation 5.1.1 & 5.1.0]

    Adding an
    ARAnchor
    to a
    GameObject
    which has an
    AREnvironmentProbe
    causes the position of the GameObject to change between the intended position and the world
    Vector3.zero
    position.

    This appears to occur when either the
    ARAnchor
    or
    AREnvironmentProbe
    is updated.

    In my scenario, I first Instantiate a GameObject which is being placed as a child of the
    XROrigin
    . Immediately, the
    AREnvironmentProbe
    is added to the GameObject. Later, once the user confirms the position of the GameObject, the
    ARAnchor
    is added.

    The position of the GameObject changes seemingly randomly between the world
    Vector3.zero
    and the expected position.

    [Edit] Also the orientation of the Transform changes between
    Quaternion.Identity
    and the expected orientation.
     
    Last edited: Nov 27, 2023
  2. andyb-unity

    andyb-unity

    Unity Technologies

    Joined:
    Feb 10, 2022
    Posts:
    956
    It's an error to add a trackable component to a GameObject that already contains a trackable component. The managers will stomp on each other when they go to update the Transform. Use separate GameObject hierarchies for AREnvironmentProbes and ARAnchors.