3Dlove Posted August 10, 2015 Share Posted August 10, 2015 Hello guys, I have a bug when I change tab, for instance : I use my BJS application, I change tab and when I return in the BJS tab, my camera is moving very speed with its deplacements (FreeCamera) : Here is an example : http://playground.babylonjs.com/#187ZXF Any ideas ? Have a nice day Quote Link to comment Share on other sites More sharing options...
jerome Posted August 10, 2015 Share Posted August 10, 2015 I can't reproduce what you mean but here is a lead : When you change the tab, you no longer show the tab (the BJS one) where the javascript RequestAnimationFrame() method (RAF) is called . RAF is designed to stop executing if the tab running it is no longer displayed in order to spare CPU and GPU resources. Meanwhile, if in the same tab you have other javascript functions running independently from RAF (say, a loop, some setTimeOut() function, some callback functions, physics, etc), they still keep executing even if the tab isn't currently displayed. So some values can evolve (coordinates, etc) whereas the related things to be rendered aren't displayed meanwhile. not sure I'm very clear... many weeks without writing a word in english Quote Link to comment Share on other sites More sharing options...
3Dlove Posted August 10, 2015 Author Share Posted August 10, 2015 NP I almost understood what you want mean Tu peux parler en français, je le suis aussi^^Dans l'exemple du PG que j'ai donné, j'arrive également à reproduire le bug, donc ça ne vient pas d'une autre fonction qui est exécutée en dehors de la boucle de rendu BJS.Si je me déplace avec les flèches directionnelles, et que je reste appuyé sur une flèche en cliquant sur un autre onglet, je fais ma vie puis je reviens sur l'onglet de BJS, je me déplace à nouveau et à cet instant, j'ai l'impression d'être speedy gonzales, ça se déplace ultra vite et puis ça revient à la normal, il y a même eu des fois où j'ai réussi à traversé des murs alors qu'il gèrent la colision. Quote Link to comment Share on other sites More sharing options...
davrous Posted August 10, 2015 Share Posted August 10, 2015 Yes, this is because of the way requestAnimationFrame is handled and we're measuring time elapsed between frames to adjust cameras' speed.As far as I remember, the browsers also expose the fact that we've changed tab or the tab visibility status. We just need to take that into consideration to fix this bug. Quote Link to comment Share on other sites More sharing options...
3Dlove Posted August 28, 2015 Author Share Posted August 28, 2015 Okay, is this feature in the road map ? 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.