yoric Posted August 21, 2015 Share Posted August 21, 2015 Hi folks, This error message must look very familiar to anyone of you, and is be pretty straightforward. However, i was expecting no error in this situation : http://www.babylonjs-playground.com/#1ZOJIM As you can see, i import a scene (made with Blender, and exported in .babylon format). The camera was made in Blender and is embedded into the .babylon file.Using the mouse and arrow keys from the playground works pretty well. When i debug my scene in the console, i can see my active camera : Everything's fine, i get the camera working from the .babylon file, so why is this error message is popping up in a red square box still ? Do i need to explicitly create a second camera by script so the compilation won't show any error, or is there another workaround ? Quote Link to comment Share on other sites More sharing options...
gryff Posted August 21, 2015 Share Posted August 21, 2015 Yoric - welcome to BJS I always get the camera from the blender created .babylon file with this kind of code:var myCamera = newScene.getCameraByName("Camera");then make it the active camera. But I'm just a blender user - maybe the coders will have more info. cheers, gryff yoric 1 Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted August 21, 2015 Share Posted August 21, 2015 Hello this is because the scene is loaded asynchronously and the playground checks if you created a camera right after your code is executed.here is a fix for you:http://www.babylonjs-playground.com/#1ZOJIM#3 yoric 1 Quote Link to comment Share on other sites More sharing options...
yoric Posted August 24, 2015 Author Share Posted August 24, 2015 Fantastic !Thank you so much for your great answers and warm welcoming ! Regarding this error, it makes sense that the "executeWhenReady()" function is executed after the playground actually checks for a camera. I understand it better. Thanks for the explanation Deltakosh. Actually i tested this code on my local web server first, and had no issue. I got started with this well detailed tutorial from David Cathue "How to load a .babylon file produced with blender" http://blogs.msdn.com/b/eternalcoding/archive/2013/06/28/babylon-js-how-to-load-a-babylon-file-produced-with-blender.aspx Then, i wanted to use the playground because it's so handy to show results to someone else. i understand there are slight differences between using the playground or one's own web server. From now on, I will be using a createScene() function, as nicely illustrated in Deltakosh's link, so the code can work everywhere.If i got it well, it also means i have better to create a new camera each time i use BabylonJS, rather than using the one created into Blender. @gryff : Thanks for your advice.It's nice to have Blender users here. I'm learning Blender myself and BabylonJS at the same time, and it seems there are a lot to cover and share The playground is so great to experiment OpenGL scenes and animations. I've never been so excited about programming since my very first steps back into the 80's with HyperTalk and HyperCard. I believe graphic and visual feedback are so important when programming as it can boost your imagination and motivation to go further. WebGL's direct access to GPU gives tremendous performance,and BabylonJS make it easy and simple to use :-) Thank you everyone for making it happen. gryff and GameMonetize 2 Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted August 24, 2015 Share Posted August 24, 2015 Excellent Quote Link to comment Share on other sites More sharing options...
gryff Posted August 28, 2015 Share Posted August 28, 2015 It's nice to have Blender users here. I'm learning Blender myself and BabylonJS at the same time, and it seems there are a lot to cover and share I try to help where I can Yoric. I let the experienced programmers - and there are a lot of very good ones on this forum - answer the code stuff cheers, gryff 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.