Jump to content

Uncaught TypeError: Cannot read property 'push' of undefined


fczuardi
 Share

Recommended Posts

I don't know if this is the proper place to report bugs, but I couldnt find the Issues link of this project github page.

I am trying to use babylon as a browserify module with the budo webserver: https://github.com/mattdesl/budo

Here is my index.js:

	var BABYLON = require('babylonjs/babylon.max');
var html = require('bel');
var canvas = html`<canvas id="renderCanvas"></canvas>`;
document.body.appendChild(canvas);
	window.addEventListener('DOMContentLoaded', function() {
    console.log('DOMContentLoaded');
    console.log(canvas);
    var engine =  new BABYLON.Scene(canvas, true);
});
	

Then, when I open localhost:9966 I get the error of the title:

"Uncaught TypeError: Cannot read property 'push' of undefined"

The line that throws this error is the line 16958 of babylon.max.js which might be coming from https://github.com/BabylonJS/Babylon.js/blob/49bde9f67194ecc773c07a4ee0064fe836914b59/src/babylon.scene.ts#L575

Any ideas of what I could be doing wrong?

Thanks!

Link to comment
Share on other sites

Hello,

I guess you forgot the creation of the engine and are creating the scene directly which tries to add itself to the engine on the line you shared but as the engine is replaced by a canvas in your case, the property scenes does not exist and ends up in the exception you see. try the following instead:

var engine = new BABYLON.Engine(canvas, true);

 var scene = new BABYLON.Scene(engine);

 

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...