1

Since LiDAR has been built into the newest 2020+ iOS devices (iPhone 12 Pro, iPad Pro).

ARKit has more possibilities than ever, including support for exporting to .obj.

Here is the code for exporting a ARReferenceObject to .arobject

guard let testRun = self.testRun, 
      let object = testRun.referenceObject, 
      let name = object.name 
else {
    print("Error: Missing scanned object.")
    return
}
    
let documentURL = FileManager.default.temporaryDirectory
                             .appendingPathComponent(name + ".arobject")
    
DispatchQueue.global().async {
    do {
        try object.export(to: documentURL, 
                previewImage: testRun.previewImage)
    } catch {
        fatalError("Failed to save the file to \(documentURL)")
    }
}

How do you export as .obj?

grantespo
  • 2,233
  • 2
  • 24
  • 62

1 Answers1

1

Sparse point cloud contained in .arobject file can't be exported as 3D geometry.

So the answer is: NO.

Andy Jazz
  • 49,178
  • 17
  • 136
  • 220
  • so just replacing `.appendingPathComponent(name + ".arobject")` with `.appendingPathComponent(name + ".usd")` should successfully export the `ARReferenceObject` in `.usd` format? – grantespo May 13 '21 at 15:31
  • the sample scanner app uses `ARSCNView` but that post uses `ARView` thus `let meshAnchors = frame.anchors.compactMap { $0 as? ARMeshAnchor }` gives me `nil`. Is it possible to substitute RealityKit instead of Scenkit for scanning ARReference Objects? – grantespo May 13 '21 at 18:23