Search the Community
Showing results for tags 'idk'.
-
Hey guys, I am just plainly getting fed up with this, sorry for saying that. But here's the main issue, and I swear it just has to be a bug. Okay, I can load up a babylon scene file of my mesh, okay works perfectly fine. I can do it with SceneLoader.Load and ImportMesh. Works perfectly fine. However, the second I try to export an Animation from max (with the Exporter). It goes crazy, it no longer recognizes the engine.runRenderLoop(function () { scene.render(); }); With both Load and ImportMesh. I just plainly don't know what else to do. it works in SandBox. But it refuses to load on the Website. Well it says it creates the model (via console log). But it just plainly doesn't like the above snipper of code, it keeps saying Camera isn't defined. When it fact it is (I created one in Max Scene), I also try to create one via code, and it just crashes and says it doesn't recognize any of this // var camera = new BABYLON.FreeCamera('camera1', new BABYLON.Vector3(0, 5, -10), scene); // camera.attachControl(canvas, false); // scene.camera = camera; // scene.activeCamera.attachControl(canvas); Yes they are commented out, because it doesn't like them. In fact 95% of my code is commented out because it doesn't like any of these two things // BABYLON.SceneLoader.Load("", "Model/WomanBabylonConvert/Woman.babylon", engine, function (scene) { BABYLON.SceneLoader.ImportMesh("character1", "AnimationStock/", "Woman.babylon", scene, function (newMeshes, particleSystems, skeletons) { Here is the entire code. window.addEventListener('DOMContentLoaded', function(){ var canvas = document.getElementById("renderCanvas"); var engine = new BABYLON.Engine(canvas, true); var createScene = function () { var scene = new BABYLON.Scene(engine); // BABYLON.SceneLoader.Load("", "Model/WomanBabylonConvert/Woman.babylon", engine, function (scene) { BABYLON.SceneLoader.ImportMesh("character1", "AnimationStock/", "Woman.babylon", scene, function (newMeshes, particleSystems, skeletons) { // Wait for textures and shaders to be ready var mesh = newMeshes[0]; mesh.rotation.y = Math.PI; mesh.position = new BABYLON.Vector3(0, 0, 0); scene.beginAnimation(skeletons[0], 0, 100, true, 1.0); scene.executeWhenReady(function () { // Attach camera to canvas inputs var light = new BABYLON.HemisphericLight("hemi", new BABYLON.Vector3(1, 0, 1), scene); // var camera = new BABYLON.FreeCamera('camera1', new BABYLON.Vector3(0, 5, -10), scene); // camera.attachControl(canvas, false); // scene.camera = camera; // scene.activeCamera.attachControl(canvas); // var mesh = scene.mesh; //mesh.position = new BABYLON.Vector3(0, 0, -8); // var sphere = BABYLON.Mesh.CreateSphere("sphere1", 16, 2, scene); // scene.meshes[0].scaling = new BABYLON.Vector3(1, 1, 1); //mesh.scaling = new BABYLON.Vector3(20, 20, 20); // console.log(scene.cameras[0]); console.log(scene.meshes[0]); //scene.meshes[0].convertToFlatShadedMesh(); //scene.meshes[0].showBoundingBox = true; light.groundColor = new BABYLON.Color3(0.2, 0, 0.3); var ground = BABYLON.Mesh.CreateGround('ground1', 6, 6, 2, scene); // Once the scene is loaded, just register a render loop to render it // engine.runRenderLoop(function () { // scene.render(); // }); }); }, function (progress) { // To do: give progress feedback to user }); return scene; } var scene = createScene(); // Once the scene is loaded, just register a render loop to render it engine.runRenderLoop(function () { scene.render(); }); // window.addEventListener("resize", function () { // scene.resize(); // }); }); I seriously don't know what else to do. All I am trying to do is load a .babylon file that has an Animation... (IT WORKS WITHOUT ANIMATION). But not with an animation. Please help me. Sorry if I sounded kinda rude, been at this single problem for 14 hours today.