我想知道是否有人知道是否可以加载 AR 对象(例如从 web url 加载.usdz 并将其放置在 AR 视图中)。我试过这个:
let fileUrl = NSURL(string: "https://developer.apple.com/augmented-reality/quick-look/models/drummertoy/toy_drummer.usdz")
cancellable = Entity.loadModelAsync(contentsOf: fileUrl! as URL)
.sink(receiveCompletion: { completion in
self.cancellable?.cancel()
}, receiveValue: { [self] (model: Entity) in
if let model = model as? ModelEntity {
let anchorEntity = AnchorEntity(anchor: anchor)
anchorEntity.addChild(model)
arView.scene.addAnchor(anchorEntity)
loadingView.isHidden = true
}
})
但它不工作并抛出错误Failed to open scene 'https://developer.apple.com/augmented-reality/quick-look/models/drummertoy/toy_drummer.usdz'.
如果可能的话,你会吗?