</style> Posted October 1, 2015 Share Posted October 1, 2015 I am very new to Babylon, I am designing an app with visual studio using html5, css3, and JavaScript. I am trying to use the code from the Babylon.js website, I copy pasted the code to a html doc and it sees the doc but won't load the image. I keep getting the error ''Babylon not defined'' in this line:var engine = new babylon.engine(canvas, true); Any help would be appreciated! Quote Link to comment Share on other sites More sharing options...
Temechon Posted October 2, 2015 Share Posted October 2, 2015 Hello, It's very hard for us to understand what you ar etrying to do without any code.. Can you post your code, or a link to a server ?Anyway, did you try to write BABYLON or babylon? The case is important, and you have to write BABYLON in upper case. Quote Link to comment Share on other sites More sharing options...
jerome Posted October 2, 2015 Share Posted October 2, 2015 usually, this case happens when the BJS file isn't loaded Jaskar 1 Quote Link to comment Share on other sites More sharing options...
Dad72 Posted October 2, 2015 Share Posted October 2, 2015 your error is here: var engine = new babylon.engine(canvas, true); We must write var engine = new BABYLON.engine(canvas, true); As explained Themechon. Check that the file Babylon.js is use as Jerome says Quote Link to comment Share on other sites More sharing options...
Jaskar Posted October 2, 2015 Share Posted October 2, 2015 Welcome on the BJS forum I copy pasted the code to a html doc I don't think you understood what BabylonJS is.Basically, it's a Javascript library, that help you handle pure WebGL code, and offering you functions to create and design a 3D game in HTML page.As a library, BabylonJS has to be loaded in your HTML page, as other JS files.<script src="http://cdn.babylonjs.com/2-1/babylon.js"></script>So, Babylon is a library, and all Babylon functions are in the BABYLON block.When you want to call something related to BabylonJS, you must write "BABYLON.yourThingToCall", in upper case (it's important!). In your case :var engine = new BABYLON.engine(canvas, true);To introduce you gently in BabylonJS, you can follow tutorials on the offical doc here .If you want to go further, you can follow these tutorials. If you prefer to have book in your hands, you can try the official e-book . If you have any questions, feel free to ask on this forum. Hope I was clear and helped correctly. Quote Link to comment Share on other sites More sharing options...
</style> Posted October 2, 2015 Author Share Posted October 2, 2015 I tried what you suggested and I now get the error ''undefined is not a function''here is my code 3dscene.html Quote Link to comment Share on other sites More sharing options...
Dad72 Posted October 2, 2015 Share Posted October 2, 2015 Look at this extract your code: <head> <meta http-equiv="Content-Type" content="text/html" charset="utf-8"/> <title>BABYLON - Getting Started</title> <!--- link to the last version of BABYLON ---> <script src="BABYLON.2.1.debug.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> <script src="http://cdn.babylonjs.com/2-1/babylon.js"></script>Line 5 and 23 you call twice Babylon.js. This could be the problem. Keep the line 23 Quote Link to comment Share on other sites More sharing options...
RaananW Posted October 2, 2015 Share Posted October 2, 2015 You wrote engine with a low-case e (the class, not the variable). It should be new BABYLON.Engine(..........). 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.