ponahoum / three-usdz-loader

A basic USDZ file (Pixar Universal Scene Description) loader for ThreeJS
Other
114 stars 20 forks source link

loading usdz file from server #16

Closed digitalw closed 2 days ago

digitalw commented 1 month ago

Hi, I am sorry if this is clear, but I cant seem to be able load files from a server.

this.loader = new USDZLoader('/content/js'); .... this.loader.loadFile(URL, group)

I receive TypeError: FileReader.readAsArrayBuffer: Argument 1 is not an object.

If i do

fetch(URL).then(response => {response.blob()).then(blob => { this.loader.loadFile(blob, group).then(loadedModel=> this.loadedModels.push(loadedModel)); });

I get Uncaught (in promise) TypeError: filePath is undefined

What is the right way to do this? Attached is the file i am trying to load

scan.zip

digitalw commented 1 month ago

For anyone looking for an answer: This seemed to have worked for me:

fetch(URL).then(response => response.blob()).then(blob => {
            const file = new File([blob], fname);
            this.loader.loadFile(file, group).then(loadedModel=> {...