Jump to content

"You must at least create a camera" error shouldn't show up ?


Recommended Posts

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 :







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 ?

Link to comment
Share on other sites

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 :)

Link to comment
Share on other sites

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" 



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.

Link to comment
Share on other sites

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 :)

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.

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.


  • Recently Browsing   0 members

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