[3.x] Physics Interpolation - Fix CPUParticles
to work with SceneTreeFTI
#104888
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes behaviour of
CPUParticles
to behave similarly toParticles
when using physics interpolation.Notes
SceneTree
#103685 while being generally amazing had the unfortunate side effect of breakingCPUParticles
somewhatCPUParticles
contained a lot of specific code to workaround problems caused by the previous server side physics interpolation, these no longer should work in the same wayCPUParticles
is better off using a paradigm of per frame processing, while following an interpolated target (as in [3.x]CPUParticles2D
- Add ability to follow physics interpolated target #80931 which does this for 2D). The results are far superior.get_global_transform_interpolated()
(which is far more effective now that FTI is done client side)Discussion
In the interests of brevity, this PR currently only changes 2 lines to get the behaviour required. There is therefore quite a lot of unused code now in
CPUParticles
, but that might make more sense to remove in a follow up, as it makes this PR easier to review. (Related, the equivalent change in 4.x has less to remove, becauseCPUParticles
physics interpolation has not yet been forward ported).CPUParticles
now works perfectly in global and local mode (with physics interpolation on for the branch, withphysics_interpolation_mode
set to OFF and an interpolated parent it judders as expected, but users shouldn't normally be using this).GPUParticles
works perfectly in global and local mode (in bothphysics_interpolation_mode
settings for the branch.