-
-
Notifications
You must be signed in to change notification settings - Fork 21.4k
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
Physics tick counter is incorrect within frame #92903
Milestone
Comments
This is what I see as of 4.3.beta 5833f59 (Linux):
Does this mean it has the same issue as 3.x? MRP updated for 4.x: physics_tick_counter_4.x.zip |
Yes, also present in 4.x. Will add to issue. |
Fixed by #92941 in 3.x, but still present in 4.x, will change milestone and look at fixing there. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Tested versions
3.6 beta 5
(probably all earlier)
4.3 dev 6 and prior
System information
All
Issue description
While investigating an MRP, I realised that we are incrementing the physics tick counter in the incorrect place.
Currently the physics tick counter is incremented at the end of the physics tick, whereas the physics tick does not change logically until the next physics tick begins.
This means that, especially at low tick rates, the reported tick within
_process()
will be one higher than the current tick.Steps to reproduce
Minimal reproduction project (MRP)
physics_tick_counter.zip
Output:
Discussion
This may appear as a kind of "glass half empty / glass half full" kind of issue, but the problem is that input etc that occurs during the frame will report the wrong physics tick before the next one has started, which can be a problem if you e.g. position objects based on the physics tick.
It's fairly easy to solve by moving the count increment to the start of the physics tick, however, this will take some care to solve properly as it likely to cause regressions. Notably already I have confirmed that
Input.is_action_just_pressed()
would need adjustment.This problem is especially notable at low tick rates (e.g. using physics interpolation). At 10 tps, and 60 fps, the reported tick is considerably out of sync.
e.g.
The text was updated successfully, but these errors were encountered: