Jump to content

SOLVED ImportMesh to my scene from blender failed


babaorhum
 Share

Recommended Posts

Hello every one,

Thanks you fr your help,

trying to import a mesh from blender to my scene but failed...

Here's my code :    

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

    var createScene = function() {

        // This creates a basic Babylon Scene object (non-mesh)
        var scene = new BABYLON.Scene(engine);

      
        // The first parameter can be used to specify which mesh to import. Here we import all meshes
        BABYLON.SceneLoader.ImportMesh("", "scenes/", "untitled.babylon", scene, function (newMeshes) {
            // Set the target of the camera to the first imported mesh
            camera.target = newMeshes[0];
        });

                scene.registerBeforeRender(animate);

        var LinesRed = BABYLON.Mesh.CreateLines("LinesRed", [
            new BABYLON.Vector3(boxRed.position.x, boxRed.position.y, boxRed.position.z),
            new BABYLON.Vector3(planeRed.position.x, planeRed.position.y, planeRed.position.z),
        ], scene);

        // Our built-in 'ground' shape. Params: name, width, depth, subdivs, scene
        var ground = BABYLON.Mesh.CreateGround("ground1", 15, 15, 5, scene);

        return scene;

    };

    var scene = createScene();

    engine.runRenderLoop(function() {
        scene.render();
    });

    // Resize
    window.addEventListener("resize", function() {
        engine.resize();
    });


});

At first I kept my previous light, camera and so on but nothing showed up

I used the importmesh from teh playground,

it appears on sandbox

Do I have to delete the camera, light from blender and keep it on my code because i only want the mesh

Here is the browser console

Thank you all

 

Sans titre.jpg

Link to comment
Share on other sites

It would be nice if you could put your code in the tag bbcode made for that. it makes it difficult to read as it is. I personally not even look at the code when it's like that. But I say this to you. You will probably have more help.
reproduce your code on the playground would be even better. I wouldn't say the title of the topic "ImportMesh ..." :D  We do not know what the problem with a single word.

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...