Hi-Rez / Satin

A 3D Graphics Framework built on Apple's Metal
MIT License
786 stars 51 forks source link

ARObject does not update ARAnchor transforms #57

Closed Reality-Dev closed 1 year ago

Reality-Dev commented 1 year ago

From the Apple documentation on ARAnchorCopying:

Because anchor objects are immutable, ARKit must copy them to make changes from one ARFrame to the next.

Therefore, the transform values here in Satin are never getting updated (they stay the same):

fileprivate class ARObject: Object {
…
  override func update(camera: Camera, viewport: simd_float4) {
    guard let anchor = anchor else { return }
    self.worldMatrix = anchor.transform
    super.update(camera: camera, viewport: viewport)
  }

ARKit appears to require us to use the ARSessionDelegate.session(_ session: ARSession, didUpdate anchors: [ARAnchor]) method to get updated transform values.

rezaali commented 1 year ago

Just fixed this commit: e43b50f980ef864ae4bf208afa4433a2f35afe91