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

Physics interpolation - fix streaking when unhiding nodes #60584

Merged
merged 1 commit into from
Apr 28, 2022

Conversation

lawnjelly
Copy link
Member

The data flow to the VisualServer of current and previous transforms is essential for allowing correct interpolation. An optimization was present that disabled sending transforms when nodes were hidden, however this meant that when unhidden, nodes would interpolate incorrectly from the last transform received when hiding, rather than the up to date previous transform.

This PR disables the optimization and sends always sends transforms when a node is interpolated.

Fixes #60582

Notes

  • This is a quick and simple fix, but it does effectively undo the "invisible" optimization when interpolation is active, for what is effectively quite a rare case.
  • I can probably make the fix more efficient at a later date, but in the meantime, this does fix the bug.
  • Alternatively we could wait and leave the bug active.

Teleporting

An alternative approach which has no performance implications is simply to reset_physics_interpolation() (teleport) whenever these nodes are unhidden. However teleport always means there will effectively be no interpolation for the first physics tick, which could result in a slight visual judder, especially for cases where nodes are hidden and unhidden frequently, so it would be nicer to use the fix in this PR or similar with no visual artifacts.

The data flow to the VisualServer of current and previous transforms is essential for allowing correct interpolation. An optimization was present that disabled sending transforms when nodes were hidden, however this meant that when unhidden, nodes would interpolate incorrectly from the last transform received when hiding, rather than the up to date previous transform.

This PR disables the optimization and sends always sends transforms when a node is interpolated.
@lawnjelly lawnjelly requested a review from a team as a code owner April 28, 2022 11:22
@lawnjelly lawnjelly added this to the 3.5 milestone Apr 28, 2022
@akien-mga akien-mga merged commit 59e84be into godotengine:3.x Apr 28, 2022
@akien-mga
Copy link
Member

Thanks!

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