toaru Posted July 29, 2018 Share Posted July 29, 2018 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 https://www.babylonjs-playground.com/#AL6VAN Could any one help me. Thanks. Quote Link to comment Share on other sites More sharing options...
brianzinn Posted July 29, 2018 Share Posted July 29, 2018 Welcome to the forum. That Playground is actually a playground - thanks for sharing you can use setInterval. I think what you had was generating a sphere, but you have to add an impostor and the actions again: https://www.babylonjs-playground.com/#AL6VAN#2 ps: everyFrame is ~60 spheres/second Quote Link to comment Share on other sites More sharing options...
MinZe Posted July 30, 2018 Share Posted July 30, 2018 There is a little bug with this, open the playground, change the tab for a few seconds and return to the tab ^^ Quote Link to comment Share on other sites More sharing options...
brianzinn Posted July 30, 2018 Share Posted July 30, 2018 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. http://doc.babylonjs.com/api/classes/babylon.engine#stoprenderloop 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.