Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

213
Visualizações
Cannot run files from babylon.js in the browser on my local machine

I am trying to embed 3D models in the browser with Babylon.JS. The code that runs perfectly on the babylon playground will not run on my local machine. I am using this example: https://playground.babylonjs.com/#JUKXQD

I then downloaded the file as a zip and ran index.html in my browser. It shows me a blank purple screen. I have been trying this for a while and it seems to be unable to import code from my local machine. When I build 3D models with the script that displays fine in the browser on my laptop.

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

Bablyon must download the skull asset into the view however when running a local file you'll run into the CORS request issue:

Access to XMLHttpRequest at 'file:///C:/Users/user/Downloads/sample/scenes/skull.babylon' 
    from origin 'null' has been blocked by CORS policy: 
Cross origin requests are only supported for protocol schemes: 
    http, data, chrome, chrome-extension, chrome-untrusted, https.
babylon.js:16 BJS - [11:28:23]: Unable to load from scenes/skull.babylon: 
    importMesh of undefined from undefined version: undefined, exporter version: 
   undefinedimportMesh has failed JSON parse

Therefore the scene is working, but the download didn't occur.

To correct this, load a "server" to run the frontend app - such as a python server (or anything of which can serve the index.html)

Downloads> cd sample
Downloads\sample> py -m http.server

Serving HTTP on :: port 8000 (http://[::]:8000/) ...
::1 - - [19/Oct/2021 11:27:58] "GET / HTTP/1.1" 200 -
::1 - - [19/Oct/2021 11:27:59] "GET /scenes/skull.babylon HTTP/1.1" 200 -

Navigate to the address given http://localhost:8000/ and it should work now (You can see the skull asset GET request)

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda