-
-
Notifications
You must be signed in to change notification settings - Fork 35.7k
THREE.clock.getElapsedTime has a side effect invalidating .getDelta() #5696
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Uh oh! |
See mrdoob#5696 - adds a function to update elapsed time since the math is done in two places. As far as I can tell, getDelta() shouldn't care about the elapsed time, so I removed the calculation from there.
See mrdoob#5696 - adds a function to update elapsed time since the math is done in two places. As far as I can tell, getDelta() shouldn't care about the elapsed time, so I removed the calculation from there.
In issue #11444 I also noted this problem, along with some others, and proposed some code which would completely decouple the two functions from each other. The changes I proposed are based on r85. |
I just lost two days trying to play animation because of this. Thank god i found this thread. Can this be at least mentioned in the Clock docs? |
Spent a solid hour debugging my program and finally found this... how is this an Enhancement not a Bug? |
This issue is opened since 2014 and this is still a bug. Most importantly: The current clock doesn't allow to |
At this point, please use the new Timer class if you experience issues with |
https://github.com/mrdoob/three.js/blob/master/src/core/Clock.js#L40
If the user's render function calls both
getElapsedTime
andgetDelta
in arequestAnimationFrame
, the code will not work properly and it will be impossible to debug why without the "aha" moment of looking at the source. These two functions should not conflict with each other.It's because
getElapseTime
callsgetDelta
, so for example if your code looks like this:the delta will actually be the time between those two var statements!
A workaround for now is to call
getDelta()
first, which will get the delta between getDelta and the last getElapsedTime call, which is not ideal.The text was updated successfully, but these errors were encountered: