Jump to content

[BUG] Speed FreeCamera Movements onTabClick


Recommended Posts

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

  • 3 weeks later...

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