Hello fellow developers,
When attempting to merge single rooms into one model, the resulting floorplan I got appears to have rooms stacked on top of each other.
I am using a single ARSession for all the scans, to my understanding, the world coordinate system remains consistent during a continuous ARSession. I can't figure out why the rooms are overlapping or positioned vertically on top of each other in the generated floorplan. I am uncertain whether this issue stems from my own code implementation.
I did the following modification to the sample code
Initiated an ARSession in RoomCaptureViewController
private var arWorldTrackingConfig: ARWorldTrackingConfiguration = ARWorldTrackingConfiguration()
private var arSession: ARSession = ARSession()
Pass ARSession to roomCaptureView
private func setupRoomCaptureView() {
arSession.run(arWorldTrackingConfig)
roomCaptureView = RoomCaptureView(frame: view.bounds, arSession: arSession)
roomCaptureView.captureSession.delegate = self
roomCaptureView.delegate = self
view.insertSubview(roomCaptureView, at: 0)
}
Pause the ARSession after completion of scanning one room
private func saveSession() {
isScanning = false
roomCaptureView?.captureSession.stop(pauseARSession: false)
setCompleteNavBar()
}
@IBAction func saveScanning(_ sender: UIBarButtonItem) {
if isScanning { saveSession() } else { cancelScanning(sender) }
self.exportButton?.isEnabled = false
self.activityIndicator?.startAnimating()
}
Any experiences or insights are greatly appreciated.