Jump to content

SceneLoader.Append, Playground and Camera


Recommended Posts

I have not been a big user of the Playground - I usually test my  Blender scene exports with the Sandbox. However, as SceneLoader.Load is considered deprecated, I thought I would test out SceneLoader.Append using the PG.

I disabled both the standard BJS light and Camera as the scene I used contains a light and a camera - and here is my result:

gryff's PG

And I see the figure and the animation is working, but I get this big box that says : "Compilation error. You must at least create a camera"

Now since I can see the figure and animation - where is the camera coming from?

It seems to be using the light from the appended file, but both the ways I tried to use the babylon scene file camera throw this Compilation Error.

(The other way I tried is to  activate line 26 and deactivate lines 31-35)

So is this a.) my clumsy coding  or b.) my lack of understanding of the PG or c.) something else??

And in addition, it seems that the material for the figure is ignored. This is a link to the same animated figure showing what the material should be:

Animation Test

Any thoughts greatly appreciated - and hopefully a fix - before this pile hair beside my desk  gets any bigger :lol:

cheers, gryff :)

Edi: If you check your console, you will see the position of the camera from the file I used.

Link to comment
Share on other sites

Remember, SceneLoader.Load is just a one line function that calls SceneLoader.Append.  Load is deprecated primarily due to novice user code issues, and issues when loading multiple .babylon files in a scene.  Better to start out using Append.  Playground only uses one .babylon & no code runs afterward, so no worries there.  Probably should switch it to Append, so message does not end up in console though.

Sam is right.  Append is async.  And executeWhenReady() only registers a function to run later.  It does not actually block.  The code continues on immediately.  That check must run after createScene() ends.  It is a minor issue here.  The real lesson is not to put code after a executeWhenReady() in a function.

FYI, you can get detailed logging of a .babylon by:

BABYLON.SceneLoader.loggingLevel = BABYLON.SceneLoader.DETAILED_LOGGING;

This can rule out many issues.  I added it in 2.4.  @Deltakosh did not want to change behavior, so he set it to minimal by default.  I think that was a mistake, but it is his toy.  Here is with it set

Link to comment
Share on other sites

@Samuel Girardin , @JCPalmer , @Deltakosh 

Merci et/and thanks for the feedback. I had forgotten all about the async aspect of loading of scene files :wacko:

And thanks Jeff for the loggingLevel code - something new to me so a simple lesson learned - gives a nice summary of the babylon file:)

And thanks DK for the


code. Another lesson learned. I had actually tried last night what I considered a hack - creating a dummy camera but not attaching it to the canvas - and that worked. Nice to know there is an official way of doing it ;)

What I have started to realize is that features are being added to BJS a such a rate that I am falling behind with my knowledge of these features - and not sure I will ever manage to keep up:o

cheers, gryff :)

Link to comment
Share on other sites


Append is great, if you want just get rid of the No Camera found in scene error.

you can also set the scene.activeCamera = false; Whichtells the editor not looking for a default camera (for my understanding)


Nice Model btw, funny play with, you should continue work on

Edited by Nabroski
offtopic: added bane::change the callstack:clean up
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...