hit2501 Posted February 16, 2015 Share Posted February 16, 2015 Hello. I have some problems when I want to export a simple scenario with an animation of a door closing and opening from Blender to Babylon, when I exported the door does not move, part of the door is distorted and the whole scene is with low light. Someone can help me have successfully exported my scenario? Here is my .blend file: https://mega.co.nz/#!yJlBSJQJ!F2pP-UU3iB1gJ5XD-UDO42fuc6NUXUsbn1on5ELrTzY This is the code I use to import babylon: <!DOCTYPE html><html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Door</title> <!-- Babylon.js --> <script src="js/hand.minified-1.2.js"></script> <script src="js/cannon.js"></script> <script src="js/oimo.js"></script> <script src="js/babylon.js"></script> <style> html, body { overflow: hidden; width: 100%; height: 100%; margin: 0; padding: 0; } #renderCanvas { width: 100%; height: 100%; touch-action: none; } </style> </head> <body> <canvas id="renderCanvas"></canvas> <script> var canvas = document.getElementById("renderCanvas"); var engine = new BABYLON.Engine(canvas, true); var createScene = function () { var scene = new BABYLON.Scene(engine); //SKYBOX var skybox = BABYLON.Mesh.CreateBox("skyBox", 1000.0, scene); var skyboxMaterial = new BABYLON.StandardMaterial("skyBox", scene); skyboxMaterial.backFaceCulling = false; skyboxMaterial.reflectionTexture = new BABYLON.CubeTexture("skybox/skybox", scene); skyboxMaterial.reflectionTexture.coordinatesMode = BABYLON.Texture.SKYBOX_MODE; skyboxMaterial.diffuseColor = new BABYLON.Color3(0, 0, 0); skyboxMaterial.specularColor = new BABYLON.Color3(0, 0, 0); skybox.material = skyboxMaterial; //CAMERA var camera = new BABYLON.FreeCamera("camera1", new BABYLON.Vector3(0, 5, -10), scene); scene.activeCamera = camera; scene.activeCamera.attachControl(canvas); scene.activeCamera.keysUp.push(87); // W scene.activeCamera.keysLeft.push(65); // A scene.activeCamera.keysDown.push(83); // S scene.activeCamera.keysRight.push(68); // D camera.setTarget(BABYLON.Vector3.Zero()); camera.attachControl(canvas, true); var light = new BABYLON.HemisphericLight("light1", new BABYLON.Vector3(0, 1, 0), scene); light.intensity = 0.7; BABYLON.SceneLoader.ImportMesh("", "THE FOLDER WITH .BABYLON/", "MYBABYLONNAME.babylon", scene, function (newMeshes) { camera.target = newMeshes[0]; }); camera.speed = 1; camera.maxZ = -250; return scene; }; var scene = createScene(); engine.runRenderLoop(function () { scene.render(); }); window.addEventListener("resize", function () { engine.resize(); }); </script></body></html>Sorry if the solution is obvious, I have not much experience with babylon. Thank you very much to all. Quote Link to comment Share on other sites More sharing options...
JCPalmer Posted February 16, 2015 Share Posted February 16, 2015 First, probably a good idea to actively confirm the load worked. Chasing ghosts is a fool's game. BABYLON.SceneLoader.ImportMesh("", "THE FOLDER WITH .BABYLON/", "MYBABYLONNAME.babylon", scene, function (newMeshes) { console.log("was successful " + newMeshes.length); if (newMeshes[0].getAnimatables()) console.log("n skeleton animations: " + newMeshes[0].getAnimatables().length); if (newMeshes[0].animations) console.log("n position, rotation, & scaling animations " + newMeshes[0].animations.length); camera.target = newMeshes[0];});Skeletal animations DO not auto play from Blender. Need something like:var skeleton = scene.getSkeletonById(0); scene.beginAnimation(skeleton, 1, XXX, true, 1); Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.