Jump to content

create a new mesh per second?


Recommended Posts

Hello everyone, I'am just starting learning babylon js to build an environment for the demo of my AI project and I had a problem here.

What I want to do is very simple, I'd like to automatically create a "Ball" every second for example.

I tried to use OnEveryFrameTrigger on scene, but it does not work.

Here is a link of playground


Could any one help me. Thanks.

Link to comment
Share on other sites

It's not really a bug.  When the tab switches, the Scene doesn't render - that's a good thing if you have lots of tabs open!  That can definitely cause some undesired behaviour.  One solution is to run in the background, so start your create scene like this:

engine.renderEvenInBackground = true;

Other solution is to hook into window.addEventListener(...) for 'blur' and 'focus' and to pause your engine render loop.

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...