Complete easing for transform changes outside fixed time step#10
Complete easing for transform changes outside fixed time step#10Jondolf wants to merge 8 commits into
Conversation
|
@Jondolf Any chance this is going to get merged? I don't like the idea of dealing with overstep and |
|
I believe this would also resolve an issue with Here's my alternative to fix my particular issue: https://github.com/andriyDev/bevy_transform_interpolation/tree/fix_any_transform_change |
Objective
Currently, changing the
Transformof an interpolated or extrapolated entity outside of the fixed time step (e.g. inUpdate) disables easing until the start of the next fixed time step. It effectively teleports the entity and interrupts easing.While supporting
Transformchanges outside the fixed time step is useful, this moment where easing is not applied has been a major source of annoyance for many users. It means that mutably accessing theTransformin any capacity can cause visible stutter to movement. This negatively impacts cases such as:big_spacegrid cell transitionsWe need a way to teleport entities without breaking easing.
Solution
Rework
reset_easing_states_on_transform_change. Changing aTransformin a schedule likeUpdatewill now teleport the entity such that the current eased transform matches the new target transform, but thestartandendeasing states are updated such that the existing easing is still carried out, just from the new transform. This results in teleports that doesn't break easing.However, it also means that the end state of the interpolation won't perfectly match the value that the
Transformwas set to. I believe this is inevitable if we want the easing to be carried out smoothly. For cases where you do want a true teleportation without any easing (the old behavior), there is now aResetEasingcommand. In a way, it is similar to Godot'sreset_physics_interpolationmethod.Below you can see an object being teleported backwards by changing its
TransforminUpdate.2025-04-12.19-48-55.mp4
If we make the camera follow the entity, we see that the movement remains entirely visually smooth, and we don't even see the teleportation happening.
2025-04-12.19-49-23.mp4
Previously, the object stopped for a while whenever it was teleported.
Migration Guide
Changing the
Transformof an interpolated or extrapolated entity outside the fixed time step, such as inUpdate, no longer interrupts easing. This allows things like:big_spacegrid cell transitionswithout any visual stutter.
However, a side effect of this is that the
Transformof the entity may not perfectly match the value it was set to after easing has been completed for the current time step.To teleport an entity without any easing, or to otherwise temporarily disable easing, you may use the
ResetEasingcommand.