问题
I have a Reality Composer
scene and I want to extract it as usdz
file or any files that can be used in ARQuickLook
?
is it possible?
回答1:
From Apple's Creating 3D Content with Reality Composer document:
You can also save your composition to a .reality file for use as a lightweight AR Quick Look experience in your app or on the web. This allows users to place and preview content in the real world to get a quick sense of what it’s like.
To create a Reality file, choose File > Export > Export Project in the Reality Composer menu, and provide a name for the file. You use the Reality file that gets stored to disk just like you would use a USDZ file, as described in Previewing a Model with AR Quick Look.
回答2:
At build time, Xcode compiles your .rcproject
into a .reality
file, and AR Quick Look accepts preview items of type .reality
. Here's an example that uses AR Quick Look to preview the Experience.rcproject
taken from Apple's SwiftStrike TableTop sample code:
import UIKit
import QuickLook
import ARKit
class ViewController: UIViewController, QLPreviewControllerDataSource {
override func viewDidAppear(_ animated: Bool) {
let previewController = QLPreviewController()
previewController.dataSource = self
present(previewController, animated: true, completion: nil)
}
func numberOfPreviewItems(in controller: QLPreviewController) -> Int { return 1 }
func previewController(_ controller: QLPreviewController, previewItemAt index: Int) -> QLPreviewItem {
guard let path = Bundle.main.path(forResource: "Experience", ofType: "reality") else { fatalError("couldn't find the rcproject file.") }
let url = URL(fileURLWithPath: path)
let item = ARQuickLookPreviewItem(fileAt: url)
return item
}
}
来源:https://stackoverflow.com/questions/56539227/extract-reality-composer-scene-for-arquicklook