ARReferencePoint rotation mistake

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 ?

Did you manage to solve this issue? I am having the exact same problem with ARAnchors attached to a plane

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.

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.

@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/com.unity.xr.arfoundation@5.1/api/UnityEngine.XR.ARFoundation.ARAnchorManager.AddAnchor.html#UnityEngine_XR_ARFoundation_ARAnchorManager_AddAnchor_UnityEngine_Pose_

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

1 Like