Aerion Posted October 4, 2017 Share Posted October 4, 2017 hi all. I'm wondering why scene [ i ] = CreateScene ( engine [ i ] ) in my code at : http://babylontesting.epizy.com/ is returning undefined? This is part of assigning a completely new scene / camera / etc to each programatically created canvas. Thank you! <3 ~M Quote Link to comment Share on other sites More sharing options...
Pryme8 Posted October 4, 2017 Share Posted October 4, 2017 did you ever see this:https://doc.babylonjs.com/tutorials/how_to_use_multi-views otherwise, just define one engine, and pass the scene to it like you would do for a single scene just do it with all of them. Quote Link to comment Share on other sites More sharing options...
Aerion Posted October 4, 2017 Author Share Posted October 4, 2017 @Pryme8 they are all supposed to be different scenes with different models being loaded with different cameras, etc. Quote Link to comment Share on other sites More sharing options...
Pryme8 Posted October 4, 2017 Share Posted October 4, 2017 On 3/11/2016 at 8:35 AM, Deltakosh said: This works: var engine1 = new BABYLON.Engine(canvas1, true); var engine2 = new BABYLON.Engine(canvas2, true); Quote Link to comment Share on other sites More sharing options...
Pryme8 Posted October 4, 2017 Share Posted October 4, 2017 You might be able to use the same engine, but I have not tested it. Quote Link to comment Share on other sites More sharing options...
Aerion Posted October 4, 2017 Author Share Posted October 4, 2017 @Pryme8 i don't get it.. why isn't my code working? aren't I doing it correctly? Quote Link to comment Share on other sites More sharing options...
Pryme8 Posted October 5, 2017 Share Posted October 5, 2017 what browser are you using? first replace the alert(msg) with console.log(msg); unless you want those dialog popups and hit f12 to view the developers console. scene.ambientColor = new BABYLON.Color3(1, 1, 1); -> produces Uncaught TypeError: Cannot set property 'ambientColor' of undefined at main.php:316which is going to make all the scene invalidate because they never compile due to the error. start using your console and all answers will come easier to you. Quote Link to comment Share on other sites More sharing options...
Aerion Posted October 5, 2017 Author Share Posted October 5, 2017 @Pryme8 it returned one canvas. then "undefined" for scene [ i ] = CreateScene ( engine [ i ] ); Quote Link to comment Share on other sites More sharing options...
Sebavan Posted October 5, 2017 Share Posted October 5, 2017 Please try to share playgrounds and BJS related code. In your page you have a mix of scene being the scene and being accessed as an array F12 is directly showing it to you. Quote Link to comment Share on other sites More sharing options...
Aerion Posted October 5, 2017 Author Share Posted October 5, 2017 @Sebavan which browser are you using to get this information? Quote Link to comment Share on other sites More sharing options...
Sebavan Posted October 5, 2017 Share Posted October 5, 2017 Chrome/FF/Edge/Safari/Vivaldi/Brave or any desktop browsers. They mostly all have dev tools. You should really begin by learning the basis of JS debugging here: https://developers.google.com/web/tools/chrome-devtools/javascript/ Quote Link to comment Share on other sites More sharing options...
Aerion Posted October 5, 2017 Author Share Posted October 5, 2017 bro, I already know how to use the debugger. I was just curious as to which browser you used. I know the variable is undefined. What I need to know is why. Quote Link to comment Share on other sites More sharing options...
Sebavan Posted October 5, 2017 Share Posted October 5, 2017 Cause of your code erasing the scene variable here: As I was saying "you have a mix of scene being the scene and being accessed as an array" Basically your array gets replaced by the variable which you can see in the dev tools. Rename the variable scene (and create one not in your full script scope) in the method CreateScene. Quote Link to comment Share on other sites More sharing options...
Aerion Posted October 5, 2017 Author Share Posted October 5, 2017 W00h00! It worked! Thanks bro! Turns out you can use multiple everything EXCEPT for engine. also, you can't put asynchronous functions in a loop, so you have to put the loop inside the asynchronous function instead. ***SOLVED*** Quote Link to comment Share on other sites More sharing options...
davrous Posted October 5, 2017 Share Posted October 5, 2017 @Mythros before asking new questions on the forum, please follow these rules now: 1 - learn how JavaScript is working by following various tutorials you'll find on the web 2 - learn how to use the F12 / developer tool of your favorite browser 3 - search our documentation / samples / forum / playground samples if the question can be solved that way 4 - if you still need help, use the playground to reproduce your issue to ask for help The team and great forum's members can't spend their time helping you until you've first done that. David RaananW 1 Quote Link to comment Share on other sites More sharing options...
Aerion Posted October 5, 2017 Author Share Posted October 5, 2017 i already follow the rules... 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.