Newbie question - How running Babylon .js file examples on local desktop?

Hello,

I try to run .js files examples on my desktop .(I import .js files on my desktop and open the HTML index file on the browser). I always have the same error (index.html:143 Uncaught ReferenceError: createDefaultEngine is not defined

  • at index.html:143*)with all the Babylonjs examples (Chrome or Firefox or Edge). I have tried to put the files on local server like Wamp. It doesn’t work. Could you tell me how to do , thank you.

error1(code)

the correct code to create and engine should be:
new BABYLON.Engine(canvas, true);

have you followed along with:
https://doc.babylonjs.com/babylon101/first

2 Likes

Hello Pryme,

It works fine now … Thank you !. What is strange I’m not changing the file code after importing it from the Babylon examples file . It is a code bug on each example files or an outdated function ?
Thank you again.

You might be copying from something where there are support functions embed on another script or something.

@Pierrearchi: I noticed the same thing when I got started.

The way around it was to remove the line
engine = createDefaultEngine();

It works because the engine is already created at the top of the script with
var engine = new BABYLON.Engine(...)

It probably have to be fixed. Do you talk about these examples? (and if so, which one in particular)

I just test with CornellBox and get the same error, using a local webserver. Actually I think it’s probably an issue for any playground.

@Deltakosh may know who to ping to fix this Playground Download option?

I will fix it asap… I might have broke it a week ago…

All fixed and deployed

2 Likes

Thank you for your help. Pierre.