Jump to content

Problem loading babylon file from host


Félix Flores
 Share

Recommended Posts

Hello

I want to load a scene generated from blender, the generated file is .babylon, in my local, I have no a problem loadding the sene but in the host I can´t, in the console I have the next problem:

Uncaught Error: Error status: 404 - Unable to load models/scene1/landScape.babylon at XMLHttpRequest.e.onreadystatechange (babylon.custom.js:3)

Searching in google I se that I need to add mime types but I don´t know how.

my html code is:

<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <title>Entorno Mexicano</title>
        <link href="css/style.css" rel="stylesheet" type="text/css">
        <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
    </head>
    <body>
        <canvas id="renderCanvas"></canvas>
        <!-- Carga de los js que se utilizan -->
        <!-- Babylon.js -->
        <script src="js/babylon.custom.js"></script>
        <script src="js/jquery-3.1.0.min.js"></script>
        <!-- codigo js personalizado -->
        <script src="js/main.js"></script>
    </body>
</html>

and my js file is:

if (BABYLON.Engine.isSupported()) {
        canvas = document.getElementById("renderCanvas");
        engine = new BABYLON.Engine(canvas, true);

        BABYLON.SceneLoader.Load("models/scene1/", "landScape.babylon", engine, function (newScene) {
            scene = newScene;
            
            // Wait for textures and shaders to be ready
            scene.executeWhenReady(function () {

                // Once the scene is loaded, just register a render loop to render it
                engine.runRenderLoop(function() {
                    scene.render();
                });
                
                // Funcion para cuando se redimensiona la ventana
                $(window).on('resize', function() {
                    engine.resize();
                });
            });
        }, function (progress) {
            $(".textoCarga").text( ((progress.loaded/progress.total)*100).toFixed(2) + "%");
        });
    }

Any idea why I can do

Thanks an regards 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...