Reputation: 2269
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
?
Upvotes: 1
Views: 727