System. (Mac OS:Catalina 10.15.7 ,xcode version: 12.3 , swift language version 5)

Has anyone accessed a .dae or .obj in the project file ( in files ) on an ipad/iphone and been able to create a sceneAsset from this file? I do not want to use the graphical interface in xcode and drop files in before the app builds. I want to be able to load and create a scene (.scn) with the image overlay and use whatever object origin that was in the file as the new scene origin. Is this even possible?

I have been playing with some example code with modelIO but hasn't really worked yet. ex. Call the function somewhere and tell it the filename "scannedChair"

below is from https://developer.apple.com/forums/thread/103245

func loadSavedOBJ(filename:String)->Project?{
    
    let DocumentDirectoryURL = try! FileManager.default.url(for: .documentDirectory, in: .userDomainMask, appropriateFor: nil, create: true)
    let objURL = DocumentDirectoryURL.appendingPathComponent(filename).appendingPathExtension("exampleProject")
    //return loadProject(url: fileURL)
    
    let asset = MDLAsset(url:objURL)

    guard let object = asset.object(at: 0) as? MDLMesh else {
        fatalError("Failed to get mesh from obj asset.")
    } 

    // Wrap the ModelIO object in a SceneKit object
    let scene = SCNScene()
    let node = SCNNode(mdlObject: object)
    scene.rootNode.addChildNode(node)

everywhere i try to search for this people are so focused on exporting 3d files from their app or using them in augmented reality but not so much to use scanned items in a traditional app scene. ex. I scan a chair and want that chair to be seen in a pov game or app.

*note: I am very green in xcode / swift . I'm just looking for pointers at not a solution unless it presents itself. Apologies if my terminology is completely off-base.

0

There are 0 best solutions below