Skip to content
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

[3.x] Physics Interpolation - Fix behavior on pause #93382

Merged
merged 1 commit into from
Jun 30, 2024

Conversation

lawnjelly
Copy link
Member

Resets nodes on pause, which prevents them pausing in a glitchy state (where prev and current transforms are different, and no longer being updated).

Fixes #92391 (comment)

Notes

  • This may not fix every scenario for pausing, but should fix the major ones.
  • It is possible skinned 2D might need a tweak or any other manually interpolated nodes, but will wait for MRP.

@lawnjelly lawnjelly added this to the 3.6 milestone Jun 20, 2024
@lawnjelly lawnjelly requested review from a team as code owners June 20, 2024 09:47
Copy link
Member

@Calinou Calinou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested locally on Truck Town (with a pause toggle key added), it works as expected.

Note that this introduces a visible hitch when pausing, although this is hard to notice at 60 Hz physics – even at 30 Hz, it's not that obvious. On the bright side, this has the benefit of showing you the "true" state of the game whenever you pause, which can be valuable for some use cases (such as frame-by-frame advance).

In this 120 FPS video, I spam the pause key while driving:

pause_10hz.mp4

Curiously, if you set get_tree().paused = true then false within the same frame, this will reset interpolation on everything without pausing the game:

pause_then_unpause_10hz.mp4

@lawnjelly lawnjelly merged commit e962aaf into godotengine:3.x Jun 30, 2024
14 checks passed
@lawnjelly lawnjelly deleted the fti_fix_pause branch June 30, 2024 11:10
@lawnjelly
Copy link
Member Author

Regarding the glitch, it is possible we can later look into having both a paused interpolation fraction and a running interpolation fraction, but this should hopefully deal with the major problem of paused nodes continuously interpolating between different prev and curr transforms, so should be quite serviceable for the meantime.

@lawnjelly
Copy link
Member Author

Thanks!

@akien-mga akien-mga changed the title [3.x] Physics Interpolation - Fix behaviour on pause [3.x] Physics Interpolation - Fix behavior on pause Sep 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants