Closed samreid closed 10 years ago
Let me know if this is what you expected. Scaling by dt made the photons move ridiculously slow, so I scaled by dt * 50.
Assigning to @samreid for review
A few thoughts. How about increasing the velocity of the photons instead of scaling up the dt? Also, since the sim is supposed to run at 60fps, perhaps that scale factor should have been 60 instead of 50 to match the previous behavior. Reassigned to @aaronsamuel137.
I suppose I'm a little fuzzy on how the animation stuff works.
Where do you tell what the frame rate is? Is it 60 fps for every sim, or just some?
So what is dt exactly? It seems like some scaling factor to use in each animation frame, but how is it being calculated and such?
dt is the elapsed number of milliseconds between each frame. We use requestAnimationFrame, which attempts 60fps on every platform if possible. More detail about requestAnimationFrame is available here: https://developer.mozilla.org/en-US/docs/Web/API/window.requestAnimationFrame
You can see how we calculate dt in Sim.js. Let me know if you have further questions.
Thanks for the explanations. I have now scaled the velocity of the photons instead of dt. It looks a little stutter-y now to me in the browser, but I'm not exactly sure why. Let me know what you think. Surprisingly, it looks fine on the ipad though.
assigning to @samreid for review
It is smooth on my Win8/Chrome34. What browser does it look stutter-y on?
I've tried it on Chrome, Safari and Firefox. It seems to vary quite a lot, sometimes it looks fine, other times it seems a little off. Maybe its just something with my computer. I'll show you tomorrow and see what you think.
Sounds good, thanks!
We looked at it together, and it seems smooth enough, and that the varying dt is not causing a problem. Closing.
I was surprised to see that dt wasn't used in Photon.js. Shouldn't the velocity term be proportional to the dt, so that it will run the same speed on different computers?