Add advance_on_start
option to NodeAnimation
to handle advance(0)
for each NodeAnimation
#94372
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.
As described in the AnimationPlayer documentation, the default behavior is for the animation to draw the first frame immediately after playback.
While this may be desirable for managing very different states, this behavior may cause a hitch if you want to handle a sequence of animations.
This PR can be modified to properly pass delta at start time, and an option can be added to apply the same
advance(0)
behavior at start time to eachNodeAnimation
.This option must be had for each
NodeAnimation
, not for the entireAnimationTree
since we need to be able to handle many cases, for example, the first state in a StateMachine may want to disable it and the others may want to enable it. Also, this can only be added to the lowest level -NodeAnimation
, for the same reason ascustom_timeline
, given the possibility of it being broken by nesting.However, the hitch is not yet completely eliminated; there may still be a small amount of error due to a decimal point error when comparing double values. Theget_remain()
function for the remaining time has been improved a little by setting the double value to zero by approximation. But to solve this problem completely, I think it is necessary to change all AnimationNode time comparisons to compare approximate values that take the error into account.Most of the problems have been eliminated, but in cases such as 1 animation vs. 3 animation queues, there is a possibility that the animation may not be perfectly synchronized due to a small error in the decimal point from the "animation length". Well, the results seem to be relatively stable as long as CallbackModePhysics is used.