After reading the ARKit documentation I was under the impression that SCNNode.worldPosition was the position of a node in the global Scene and would thus not change when the device is moved. However, when using ARWorldTrackingConfiguration to track images in the scene the anchor nodes of the images changes position when the device is moving around (even though the images are stationary). Is this expected behavior?
The AR-session is configured like
func resetTracking() {
guard let referenceImages = ARReferenceImage.referenceImages(inGroupNamed: "AR Resources", bundle: nil) else {
fatalError("Missing expected asset catalog resources.")
}
let configuration = ARWorldTrackingConfiguration()
configuration.detectionImages = referenceImages
configuration.maximumNumberOfTrackedImages = 4
configuration.environmentTexturing = .automatic
configuration.isLightEstimationEnabled = true
session.run(configuration, options: [.resetTracking, .removeExistingAnchors])
}
and the position is tracked in
func renderer(_ renderer: SCNSceneRenderer, didUpdate node: SCNNode, for anchor: ARAnchor) {
print(node.worldPosition)
}