Jump to content

importing from blender is not working


reggie
 Share

Recommended Posts

Hi guys,I have created a simple cube in blender and am trying to import it in babylon js.The scene is not coming and the error i am getting is this 

BJS - [14:10:21]: Unable to import meshes from miningtesting123.babylon: Failed to load scene.

The code I am using is 

BABYLON.SceneLoader.ImportMesh("","","miningtesting123.babylon",
scene,function(newMeshes)

I have ran my .babylon file in sandbox and the model is coming there. 

Link to comment
Share on other sites

I am attaching the full code that I am using.Please tell me where I am wrong.

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
 
<title>Page Title</title>
 
<script src="https://cdn.babylonjs.com/babylon.max.js"></script>
</head>
 
<body>
<canvas id="canvas"></canvas>
<script>
window.addEventListener('DOMContentLoaded', function(){
var canvas = document.getElementById('canvas');
 
var engine = new BABYLON.Engine(canvas, true);
engine.enableOfflineSupport = false; // Dont require a manifest file
var createScene = function(){
var scene = new BABYLON.Scene(engine);
scene.clearColor = new BABYLON.Color3.White();
 
var camera = new BABYLON.ArcRotateCamera("arcCam",
BABYLON.Tools.ToRadians(0),
BABYLON.Tools.ToRadians(0),
10.0,BABYLON.Vector3.Zero(),scene);
camera.attachControl(canvas,true);
var light = new BABYLON.PointLight("PointLight",new BABYLON.Vector3(
0,0,0),scene);
light.parent = camera;
light.intensity = 1.5;
 
BABYLON.SceneLoader.ImportMesh("","","miningtesting123.babylon",
scene,function(newMeshes) {
newMeshes.forEach(function(mesh){
mesh.rotation = new BABYLON.Vector3(BABYLON.Tools.ToRadians(
45),0,0);
} );
});
 
return scene;
}
 
var scene = createScene();
engine.runRenderLoop(function(){
scene.render();
});
 
});
</script>
 
</body>
</html>
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...