[v10] Prevent elapsedTime from being reset unescessarily#3618
[v10] Prevent elapsedTime from being reset unescessarily#3618AlaricBaraou wants to merge 1 commit intopmndrs:masterfrom
Conversation
|
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit 3700905:
|
|
The new API with the scheduler is a bit different but does the same (will get over today actually) and doesnt use THREE.Clock or THREE.Timer So the current operations though match the old, when you change the frameloop mode it stops the running loop. When you hit start() it resets the elapsed time (and frame count). The problem is how do you want pause/stop/resume to effect delta and elapsedTimes? What I've come up with is to reset the delta on start/stop and adjust the elapsed time and createdAt point. So if the frame is going and you hit However If we persist the elapsedTime though from the original clock though we would be 5 seconds in the future which is also incorrect (likely why they reset it to 0) So what I did is trim the This also solves when you go from a different tab/window and back and the scene jumps wildly.. I'll update when the branch is over |
|
I see, sounds like one of these issues where it's impossible to satisfy every use case. |
feat: dont reset elapsed Time on restarts. see pmndrs#3618
I don't think that setFrameLoop should affect elapsedTime.
In my use case, I temporarily set frameloop to
alwaysbefore reverting back todemand, with the current version it mess the elapsedTime.This PR only reset elapsedTime when using never, which seem to be the initial intended use case.