Lock SceneKit to newest ARPlaneAnchor

Hi,

I'm trying to get my SceneKit scene to lock to the floor, but if I move the phone to the table, the screen should be able to lock to the table too.
I've been trying with the following code with no success, any tips?



func renderer(_ renderer: SCNSceneRenderer, didAdd node: SCNNode, for anchor: ARAnchor) {
        guard let plane = anchor as? ARPlaneAnchor else {
            return
        }
       
        debugPrint("self.sceneView.scene.rootNode.position: \(self.sceneView.scene.rootNode.position)")
        debugPrint("node.position: \(node.position)")
       
        self.sceneView.scene.rootNode.transform = SCNMatrix4(plane.transform)
       
}
Lock SceneKit to newest ARPlaneAnchor
 
 
Q