ARKit Pose deprecated in VisionOS?

Different results in XCode Beta 7 and Beta 8 on VisionOS simulator:

Beta 7: the following compiles but crashes (on beta 8 Simulator?)

 private func createPoseForTiming(timing: LayerRenderer.Frame.Timing) -> Pose? 
{ ... 
   if let outPose = worldTracking.queryPose(atTimestamp: t)  {
        // will crash (Beta 7 binary on 8 simulator?)
    }
}

Beta 8: compile error "Value of type 'LayerRenderer.Drawable' has no member 'pose'"

private func createPoseForTiming(timing: LayerRenderer.Frame.Timing) -> OS_ar_pose? 
{ ...
    if let outPose = worldTracking.queryPose(atTimestamp: t) {
           // "Value of type 'LayerRenderer.Drawable' has no member 'pose'"
     }
}

Changing Pose to OS_ar_pose for Beta 8, was recognized. But, new compile error regarding queryPose

Did notice that docs say that Pose prediction is expensive. I could have sworn that there was a deprecation in the headers, but could not find.

Is Pose deprecated for VisionOS? What is the way forward?

Replies

Pose was replaced with DeviceAnchor.

private func createDeviceAnchorForTiming(timing: LayerRenderer.Frame.Timing) -> DeviceAnchor? 
{ ... 
   if let outAnchor = worldTracking.queryDeviceAnchor(atTimestamp: t)  {
        // will work on Beta 8
    }
}
  • Works, thanks!

    There were a couple other api changes that were easy to figure out. Updated example project SpatialMetal

Add a Comment