Search Unity

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

ARReferencePoint rotation mistake

Discussion in 'AR' started by bibloc, Sep 2, 2019.

  1. bibloc

    bibloc

    Joined:
    Jan 31, 2018
    Posts:
    17
    Hi everyone,

    After the relocalization of an AR reference point attached to a ground plane, we got a very slight euler angles around the X and Z axis (359, ..., 359) instead of (0, ..., 0).
    We need the anchored object to remain perfectly horizontal.

    Does anyone know why the ground plane anchors does not remain perfectly horizontal after relocalization ?
     
  2. MajorWolph

    MajorWolph

    Joined:
    Apr 28, 2018
    Posts:
    24
    Did you manage to solve this issue? I am having the exact same problem with ARAnchors attached to a plane
     
  3. andyb-unity

    andyb-unity

    Unity Technologies

    Joined:
    Feb 10, 2022
    Posts:
    956
    You cannot force an anchor (or any trackable) to not update its position or rotation along some axis. If you require a perfectly axis-aligned transform, you should guarantee this using your own logic (ie, parenting a GameObject to the anchor and calculating the offset yourself) rather than relying on the platform to maintain this constraint for you.
     
  4. MajorWolph

    MajorWolph

    Joined:
    Apr 28, 2018
    Posts:
    24
    Yes, I understand however I am using ARAnchors that are attached to ARPlanes. I was under the assumption that the anchors would stay aligned to the plane however after checking, the ARPlane’s rotation doesn’t change but the anchor will randomly switch to a slight tilt after being created. It then remains this way for the rest of the session. I’m not sure why I am meant to provide a pose when creating the anchor if it will change rotation as soon as it switches from the pending status. I know the anchor should update as the tracking state of the session changes but why does it correctly track but with a slight skew?

    I’m not sure but this seems like a bug to me.
     
  5. andyb-unity

    andyb-unity

    Unity Technologies

    Joined:
    Feb 10, 2022
    Posts:
    956
    @MajorWolph this is not a bug, but an unfortunate consequence of how the ARAnchor component is designed. The pose that you provide is the requested pose, but the AR platform may not return you an anchor at that exact pose you requested.

    I recommend for AR Foundation 5.1 and below that you actually use the deprecated AddAnchor method instead of relying on the ARAnchor component to handle everything for you: https://docs.unity3d.com/Packages/c...n_ARAnchorManager_AddAnchor_UnityEngine_Pose_

    In AR Foundation 6 we remove AddAnchor but replace it with a new TryAddAnchorAsync that you can use instead.
     
    thomas_key likes this.