Jump to content

Not managing to import Mesh


Recommended Posts


I am trying to import mesh using BABYLON.SceneLoader.ImportMesh. there doesn't seem to be any error with the code but the mesh is not loading anf the loader gui lasts forever.

I inspect the elements with google crome and it says that cannot find the objects. the assets folder is within the html folder project  and the skull.babylon is there so there is nothing wrong (I followed the video tutorial by David, he got it right but I got it wrong :angry:).

any help?

<!DOCTYPE html>
	<meta charset="utf-8" />
    <script src="javascript/babylon.2.5.js"></script>
      html, body {
         overflow: hidden;
         width: 100%;
         height: 100%;
         margin: 0;
         padding: 0;
      #renderCanvas {
         width: 100%;
         height: 100%;
         touch-action: none;

    <canvas id="renderCanvas"></canvas>
        var Canvas = document.getElementById("renderCanvas");
        var Engine = new BABYLON.Engine(Canvas, true);
        var Scene = MakeScene();
        Engine.runRenderLoop(function () { Scene.render(); })
        window.addEventListener("resize", function () { Engine.resize(); })

        function MakeScene() {
            var scene = new BABYLON.Scene(Engine);
            scene.clearColor = new BABYLON.Color3(125 / 255.0, 0, 0);

            var hLight = new BABYLON.HemisphericLight("hLight", new BABYLON.Vector3(0, 1, 0), scene);
            var aCam = new BABYLON.ArcRotateCamera("aCam", 2 * Math.PI / 3, Math.PI / 3, 30,BABYLON.Vector3.Zero(), scene);
            aCam.attachControl(Canvas, false);

            //PROBLEM IN HERE, google crome says can'T FIND FOLDER, AND OBJECT SKULL.BABYLON
            //the folder (asset)and the file are inside the project directory 
            //no comment on error in microsoft edge.
           BABYLON.SceneLoader.ImportMesh("test", "assets/", "skull.babylon", scene, function (newMeshes) {
                camera.target = newMeshes[0];

            var mGreen = new BABYLON.StandardMaterial("mGreen", scene);
            mGreen.diffuseColor = BABYLON.Color3.Green();

            var obj = BABYLON.Mesh.CreateBox("box", 5, scene);
            obj.material = mGreen;

            return scene;



Link to comment
Share on other sites

BABYLON.SceneLoader.ImportMesh("test", "assets/", "skull.babylon", scene, function (newMeshes) {

Test is not a name you assign the mesh, but a name you specify for the loader to look for, in case you want to import a specific mesh.

Null it out instead, like:

BABYLON.SceneLoader.ImportMesh("", "assets/", "skull.babylon", scene, function (newMeshes) {

To import all the meshes in the file.

At least I think it's how it is.

Link to comment
Share on other sites


It worked. I didn't notice that I have to add information to the web.config.

      <mimeMap fileExtension=".fx" mimeType="application/fx"/>
      <mimeMap fileExtension=".babylon" mimeType="application/babylon"/>
      <mimeMap fileExtension=".babylonmeshdata" mimeType="application/babylonmeshdata"/>




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.

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.


  • Recently Browsing   0 members

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