Hey. I use classes to make things organized (for example Life > Enemy > Orc > Green Orc)
And obviously to avoid putting all code in main index html file which is hardly readable
I have this file life.js:
class Life {
constructor() {
this.health = 100;
//executes
alert("lol");
// doesnt execute
BABYLON.SceneLoader.Append("./", "box.babylon", scene, function (scene) {
});
}
}
you can tell by coments what executes what doesnt. if this code is placed in index.html then it indeed adds box (my model) to the scene, but it doesnt when its not.
(my index html is just basic code from babylon homepage)
anyone knows how to make it work? Or do I have to add all objects to the scene from main index.html file?