Home > Back-end >  ARKit ARParticipantAnchor's transform is NaN in AR Collaboration
ARKit ARParticipantAnchor's transform is NaN in AR Collaboration

Time:11-16

I am running this ARKit example project https://developer.apple.com/documentation/arkit/creating_a_collaborative_session. Everything works perfectly, except that the ARParticipantAnchor's transform is always NaN (all 16 numbers in the transform matrix are NaN). Other ARAnchors all have a valid transform value but ARParticipantAnchor doesn't.

From my understanding of ARKit, after a peer iPhone joined the collaboration session, an ARParticipantAnchor is added through the delegate function session:didAddAnchors: to represent the location and orientation of that peer. After that, ARKit keeps updating that ARParticipantAnchor's transform through the delegate function session:didUpdateAnchors: to minor the real-time location and orientation of that peer's iPhone.

I have run this sample project several months ago and it went perfectly. So I am pretty confident that I am not missing any detail. But from yesterday, I could not make it work. An ARParticipantAnchor was successfully added after a peer had joined the collaboration session, and the delegate function session:didUpdateAnchors: was called every frame, but the ARParticipantAnchor's transform in session:didUpdateAnchors: was always NaN!

I also tried the Unity ARFoundation samples in this repo https://github.com/Unity-Technologies/arfoundation-samples/tree/main/Assets/Scenes/ARKit/ARCollaborationData, and it doesn't work either! I have used this repo several months ago and I am pretty sure it worked.

So, if both native ARKit and Unity have this problem, I suspect that probably there is a bug in ARParticipantAnchor after a recent ARKit update? After all, if ARParticipantAnchor's transform is always NaN, what is the point to update it every frame and share that data through the network? Could anyone tell me how to make it work? Thanks!

CodePudding user response:

Ok, I have found the solution. It was because of the iOS version.

Previously, I was running iOS 15.1, after I upgraded all my devices to iOS Beta 15.2, everything worked perfectly.

  • Related