Since then, I’ve discovered that the two functions that I originally thought were causing my problems, aren’t at all the cause of the problem. The game has produced the same lag even with those commented out, and has not lagged with them fully functioning…
This puts me back at square 1.
There is a mystery lag that occurs when I rotate the camera, I can’t narrow it down to anything in my code, and the only thing that fixes it is if I have the Chrome DevTools/console open, it never happens.
I’ve found some loosely related topics online, with similar mystery bugs that disappear with the console open, but none have had any insight as to why or what can fix it.
Does anyone know what differences there are with running javascript code if the console is open or closed? Or any ideas as to what may be causing this problem would be greatly appreciated!
I have only seen input being higher frequency when the devtools are open and i wonder if it could be the reason of your slowdown if you do anything complex with them ?
One thing I realized is that scene.picking shouldn’t be the cause, because the problem only occurs on camera rotate. If you walk straight forward it won’t lag, but scene.pick() is still running every render loop, without any lag. If scene.pick was causing the lag, it would just always lag. Also, scene.pick only takes like 2 millis.
I have placed no code in my scene.onPointerMove(), which would be where this type of lag stems from (I’m assuming).
And still, having the dev console open completely fixes the problem.