Sign in to follow this  
dbawel

[SOLVED] Any Idea Why One .babylon Scene Loads and the Same .babylon Scene Doesn't

Recommended Posts

Hello,

I have a test scene which loads fine but is a complete mess. So I cleaned it up today, and the .babylon file won't load no matter where I place it. The messy scene that loads fine is:

http://www.qedsoft.com/DEMOS2017/build_01/index8.html

 

However, I cleaned the scene up to show, and the .babylon file cannot be loaded no matter where I place it - here is the scene:

http://qedsoft.com/DEMOS2017/blimp_test/index_01.html

I also get the following console message:

Quote

babylon.max.js:sourcemap:6714 BJS - [17:02:27]: Unable to load from baloon.babylon: importScene of baloon.babylon from Blender version: 2.78 (sub 0), exporter version: 4.6.1
    Lights:
        Name: Lamp, type: Point
Tools._ErrorEnabled @ babylon.max.js:sourcemap:6714

The .babylon file and code are exactly the same. This has been a hell of a week, so I just don't know if it's me right now - but I can't see what the heck is different. It claims it cannot load the point light in the exact same .babylon file.

DB

Share this post


Link to post
Share on other sites

@RaananW-

i can't see what i'm missing... If you can show me, I'll fix it. I'm at this job to set up other things. But I still shouldn't have so much difficulty as I've been building scenes since 2014. I just don't get it. Alzheimers?

Thanks,

DB

Quote

 

var createScene = function(){

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

    BABYLON.SceneLoader.Load("", "baloon.babylon", engine, function (newScene) {

        newScene.executeWhenReady(function () {
            for(var i = 0; i < newScene.meshes.length; i++){
                let mesh = newScene.meshes;
                mesh.isVisible = true;
                
                switch(mesh.name){
                    case "Blimp_body":
                    case "engine":
                        mesh.scaling = new BABYLON.Vector3(1,1,1);
                        mesh.rotation = new BABYLON.Vector3.Zero();
                    break;
                    
                    case "prop":
                        mesh.scaling = new BABYLON.Vector3(1,1,1);
                        mesh.rotation = new BABYLON.Vector3.Zero();
                        mesh.setPivotMatrix(BABYLON.Matrix.Translation(0, 0, 10));
                    var mesh_prop = mesh
                    break;
                    
                    default:
                    break;
                }
            }
            
            
            newScene.clearColor = new BABYLON.Color3(1, 1, 1);
            

            //camera.attachControl(canvas, true);
            
            newScene.activeCamera.attachControl(canvas);
            newScene.activeCamera.minZ = 0.001;
            newScene.activeCamera.maxZ = 10000;
            newScene.activeCamera.position = new BABYLON.Vector3(90,0,0);
                
            var light = new BABYLON.HemisphericLight('light1', new BABYLON.Vector3(0,1,0), newScene);
            
            var skyboxMaterial = new BABYLON.StandardMaterial("skyBox", newScene);
                skyboxMaterial.backFaceCulling = false;
                skyboxMaterial.reflectionTexture = new BABYLON.CubeTexture("./assets/skybox/TropicalSunnyDay", newScene);
                skyboxMaterial.reflectionTexture.coordinatesMode = BABYLON.Texture.SKYBOX_MODE;
                skyboxMaterial.diffuseColor = new BABYLON.Color3(0, 0, 0);
                skyboxMaterial.specularColor = new BABYLON.Color3(0, 0, 0);
        
            var skybox = BABYLON.MeshBuilder.CreateBox("skyBox", {size:1000.0}, newScene);
                skybox.material = skyboxMaterial;
                
            scene = newScene;
                
            engine.runRenderLoop(function() {
                scene.render();
            });
    
        });
    });

/****
        scene.registerBeforeRender(function () {
        if (mesh_prop) {
            mesh_prop.rotate(BABYLON.Axis.Y, Math.PI / 64, BABYLON.Space.LOCAL);
            }
        });
****/

window.addEventListener('resize', function(){
    engine.resize();
});
        
  return scene;
};


createScene();

 

 

Share this post


Link to post
Share on other sites

Your script is in the <header>, if you put it after your <canvas> it should work.

The <header> is loaded before the <canvas> is created. So your file is calling and looking for a canvas that it can not find.

Share this post


Link to post
Share on other sites

Hey @Dad72, @Deltakosh, @RaananW, @davrous, and everyone else who has answered a post from me the past couple of weeks. I suppose I was still in shock after my house burned; but that's no excuse I can really quantify. I looked back at my questions the past couple of weeks, and realized that they were all stupid procedural errors - in which I've been using all procedures for years now - as looking at these, it's so obvious what the problem is - just nonsensical garble.

So I'm not certain what happened, but I just sat down yesterday and created several scenes in about an hour which I was having issues with - all except the pivot rotate function - as I've never used this before. Suddenly, I can write scenes from scratch once again, and they work first time. So I wanted to apologize for wasting everyone's time as there was never a real problem; the problem was that I simply couldn't write a damn thing correctly.

Already this morning, I'm close to delivering most of what I am scheduled to deliver for the day. So perhaps it was shock, stress, whatever - but everything appears fine now. I just need to get my Wife back from looking after her Mother in Thailand next week, and my life should have some order once again. But as far as babylon.js, I don't appear to have any issues now, and am transitioning into ES6 much more.

I just wanted you to know, as I couldn't look at a script and make any sense of it whatsoever. Totally weird.

Thanks,

DB

Share this post


Link to post
Share on other sites

@Pryme8, @Deltakosh, and all -

We all might get a pass from time to time, but that was just some real dumb stuff. But I appreciate the understanding that we all go a little nuts sometimes. Honestly, I just starred at the screen, and had absolutely no idea what I was looking at. And I would still try and fix it without any clue as to what I was writing. It's something I never want to experience again; as I could feel myself losing my mind...:wacko: No joke.

Anyway, thanks again. I'll try an put in some extra time on the forum to make up for it.

DB

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.