Unable to import meshes from babylon-File

Good Morning,

i have executed a React App local with yarn and in the Browser as build Version. Local there are no Errors. At the Browser there is logging in the console following Error: Unable to import meshes from bike.babylon: 404 Not Found undefined.

I’dont know why the App can’t find the bike.babylon. The JS-File is including in the index.html. The index.html is in the same Folder as the babylon File.

This is the Code:
loadModels = () => {

    let loader = new AssetsManager(this.scene) 
    // Arguments: "ID", "Root URL", "URL Prefix", "Filename"    
    let loadBikeModel = loader.addMeshTask("bike", "", "", "bike.babylon")
 
    loadBikeModel.onSuccess = ( t ) => {
      
      this.scene.getMeshByID('Sa').material = this.scene.getMeshByID('Sa').material.clone()
      this.scene.getMeshByID('Ghidon').material = this.scene.getMeshByID('Ghidon').material.clone()
      this.scene.getMeshByID('BidonRosu').material = this.scene.getMeshByID('BidonRosu').material.clone()
      this.scene.getMeshByID('Furca').material = this.scene.getMeshByID('Furca').material.clone()
      this.scene.getMeshByID('Cadru1').material.diffuseColor = this.scene.getMeshByID('Cadru1').material.clone()

      this.scene.getMeshByID('Sa').material.diffuseColor = this.colors['grey']
      this.scene.getMeshByID('Ghidon').material.diffuseColor = this.colors['grey']
      this.scene.getMeshByID('BidonRosu').material.diffuseColor = this.colors['grey']
      this.scene.getMeshByID('Furca').material.diffuseColor = this.colors['black']
      this.scene.getMeshByID('Cadru1').material.diffuseColor = this.colors['white']
      
      
      this.engine.runRenderLoop(() => { 
        this.scene.render() 
      })
      
      new HemisphericLight('light1', new Vector3(0,1,0), this.scene)
    }
    
    loadBikeModel.onError = function (task, message, exception) {
        console.log(message, exception);
    }
  
    return loader
  }

Anyone have an Idea why the bike.babylon can’t be load?

If you are sure the file is there, check your packer and see if it treats the directory as public (or static) and doesn’t “import” only index.html.

Make sure the file is accessible, check in your browser and try the file’s URL directly. Once you find the right URL and it is working correctly in the browser, try in babylon again.

1 Like

I think it should give you some error.
are you calling loader.load();
if not try this after adding task call loader.load();

1 Like

Yes. Here is a Picture of the Filestructure:
files

I have tryed to load the bike.babylon in my Browser. There comes that this File can’t be found on my server. At my twoth FTP Server there comes the same Message with a 300 HTTP Error (Multiple Choices).

I have tryed now a lot of things and seeing, that after uploading the bike.babylon to my FTP-Server the File can’t be saved there (at other FTP Server). I can’t understand it. Why the File can’t be saved at my Server?

well, it is a 21 MB file, that might be a problem. But i honestly can’t tell you why, this is something you will need to clear with the provider of the service (or - if it is you - configure the server accordingly).

If you are using a remote server, you will also need to configure CORS, otherwise the file will not be loaded correctly using JavaScript. Once again - this is something you will need to configure yourself, we sadly cannot help with it…

1 Like

This don’t give me any Errors.