Post

Replies

Boosts

Views

Activity

Can I use RWorld map together with roomCaptureView?
Does anybody know if I can use the ARWorld map together with roomCaptureView? So that I can scan and save one Room, then save the data from scan, save the ARWorldmap and then make a new roomCaptureView.captureSession to scan the new room? Right know I am first calling:  roomCaptureView?.captureSession.run(configuration: roomCaptureSessionConfig) and then roomCaptureView.captureSession.arSession.run(roomCaptureViewARconfigurationFunc) with the saved ARWorldMap.   @IBAction func saveWorldMapAction(_ sender: Any) {         roomCaptureView.captureSession.arSession.getCurrentWorldMap { worldMap, error in             guard let map = worldMap             else { self.worldMapLabel.text = "error \(error!.localizedDescription) "; return }             do {                 let data = try NSKeyedArchiver.archivedData(withRootObject: map, requiringSecureCoding: true)                 try data.write(to: self.mapSaveURL, options: [.atomic])                 DispatchQueue.main.async {                     self.loadWordMapButton.isHidden = false                     self.loadWordMapButton.isEnabled = true                     self.worldMapLabel.text = "Map Saved "                     print(" map saved")                 }             } catch {                 fatalError("Can't save map: \(error.localizedDescription)")             }         }     } @IBAction func AddNewRoomBtnPressed(_ sender: UIButton) {         sceneViewFloorPlan.alpha = 0         stopSession()         startSession()         oadWordMap() } private func startSession() {         isScanning = true         print("start roomCaptureView")         roomCaptureView?.captureSession.run(configuration: roomCaptureSessionConfig)         setActiveNavBar()     } var defaultConfiguration: ARWorldTrackingConfiguration {     let configuration = ARWorldTrackingConfiguration()     configuration.environmentTexturing = .none     return configuration } func loadWordMap(){     let worldMap: ARWorldMap = {         guard let data = mapDataFromFile             else { fatalError("Map data should already be verified to exist before Load button is enabled.") }         do {             guard let worldMap = try NSKeyedUnarchiver.unarchivedObject(ofClass: ARWorldMap.self, from: data)                 else { fatalError("No ARWorldMap in archive.") }             return worldMap         } catch {             fatalError("Can't unarchive ARWorldMap from file data: \(error)")         }     }()     let configuration = self.defaultConfiguration // this app's standard world tracking settings     configuration.initialWorldMap = worldMap     guard let roomCaptureViewARconfigurationFunc = roomCaptureView.captureSession.arSession.configuration else {         return }     isScanning = true    roomCaptureView.captureSession.arSession.run(roomCaptureViewARconfigurationFunc) setActiveNavBar() }
0
0
635
Nov ’22
Getting device location in ARWorldMap
I am using Roomplan APi to make a 2d floorplan. I am trying to make it possible to scan multiple rooms by scanning one room after the other. Does anybody know if it is possible to get the device location in the ARWorldMap so that it can be saved and the loaded back up when a new room is to be scanned and it will know where it is in the ARWorldMap? I know it can scan the surrounding area to find it location.
1
0
824
Nov ’22