I am trying to get the ARWorldTracking session to reorient north after the session is interrupted. I went through the documentation several times, but I find this confusing.
Current behavior:
When I lock the device and sessionWasInterrupted application, starting sessionWasInterrupted , SCNNodes all shift ~ 90 degrees or so counterclockwise on the compass.
When you call the run method (_: options :) with a configuration other than the current session configuration, the session always resets tracking
I interpreted this as saying that when I create a new set of configurations that is different from viewWillAppear , the session will be "reset". I donβt understand what is actually happening, but orientation after interruption is disabled. (as well as removeExistingAnchors does nothing)
override func viewWillAppear(_ animated: Bool) { super.viewWillAppear(animated) let configuration = ARWorldTrackingSessionConfiguration() configuration.planeDetection = .horizontal configuration.worldAlignment = .gravityAndHeading sceneView.session.run(configuration) } func sessionWasInterrupted(_ session: ARSession) { let configuration = ARWorldTrackingSessionConfiguration() configuration.planeDetection = .horizontal configuration.worldAlignment = .gravityAndHeading self.sceneView.session.run(configuration, options: [ARSession.RunOptions.removeExistingAnchors, ARSession.RunOptions.resetTracking]) }
Desired behavior:
When the application detects a session interruption, I would like it to focus on the real north again.
dmr07 source share