Hello. I will have a model loaded in my project. Right now my code looks like this
PreloadModel.prototype.fetchModel = function(){
fetch('https://render.cloudsgoods.com/images/avatars/24/texture/model.obj')
.then(res=>res.blob()).then(blb => {
let files = new File([blb], 'new_model.obj')
this.createAssetModel(files)
})
}
PreloadModel.prototype.createAssetModel = function(file){
const asset = new pc.Asset('newModel','model',{file})
console.log(asset)
}
Next, I want to create a model from the asset. But so far I have nothing in my asset. I guess I’m not writing the parameters for asset correctly. Tell me how to create an asset correctly in my case.
Thanks. But on a remote resource, I have a file with the .obj extension, and when I upload it to playcanvas with my hands, it is converted to .a glb model that I can insert into the scene. And when I load the model .obj via loadFromUrl, here’s what I see that the resources:null field, the file name is correctly pulled up, but there seems to be nothing inside. Maybe there is another way to load obj containers?