In the apple example code for ARKit, they provided a VirtualObject
class that load Scn files from Models.scnassets
.
static let availableObjects: [VirtualObject] = {
let modelsURL = Bundle.main.url(forResource: "Models.scnassets", withExtension: nil)!
let fileEnumerator = FileManager().enumerator(at: modelsURL, includingPropertiesForKeys: [])!
return fileEnumerator.compactMap { element in
let url = element as! URL
guard url.pathExtension == "scn" && !url.path.contains("lighting") else { return nil }
return VirtualObject(url: url)
}
}()
Let's say I have a SCNScene that download from a sever, the first question is, this SCNScene is similar to scn files?
if yes, how can I add this SCNScene to the above function, and get its URL to add it in the return VirtualObject(url: url)
? I stuck in this part for days, would be appreciated if anyone can help me.