Skip to content

Change NodeOneShot fading to uses self delta instead of input delta #101792

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

TokageItLab
Copy link
Member

@TokageItLab TokageItLab commented Jan 19, 2025

Predict the time scale from the delta difference so that the fading time does not depend on the input AnimationNode's delta.

This breaks compatibility a bit because it changes the behavior of the existing fading time scaled by the downstream time scale. However, since the scaling is specific to NodeOneShot, this should bring it closer to the behavior of other AnimationNodes.

It is possible that a strange state may be produced if the timescale is changed during a fade, but since NodeTransiton and StateMachine should have the same problem, I judge that it is not a problem. The case where the timescale is changed during a transition in AtEnd with a fade is quite niche, IMO.

The problem of the fade time and end time being out of sync as in #87009, should no longer occur, but the fade duration will change, as explained below.

</member>
<member name="fadeout_curve" type="Curve" setter="set_fadeout_curve" getter="get_fadeout_curve">
Determines how cross-fading between animations is eased. If empty, the transition will be linear. Should be a unit [Curve].
</member>
<member name="fadeout_time" type="float" setter="set_fadeout_time" getter="get_fadeout_time" default="0.0">
The fade-out duration. For example, setting this to [code]1.0[/code] for a 5 second length animation will produce a cross-fade that starts at 4 second and ends at 5 second during the animation.
[b]Note:[/b] [AnimationNodeOneShot] transitions the current state after the end of the fading. When [AnimationNodeOutput] is considered as the most upstream, so the [member fadeout_time] is scaled depending on the downstream delta. For example, if this value is set to [code]1.0[/code] and an [AnimationNodeTimeScale] with a value of [code]2.0[/code] is chained downstream, the actual processing time will be 0.5 second.
Copy link
Member Author

Choose a reason for hiding this comment

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

This deleted line is exactly what explains the change in behavior due to this PR compatibility breakdown. There is a migration path that multiplies the downstream TimeScale to the fading time of the NodeOneShot.

@AThousandShips AThousandShips changed the title Changed NodeOneShot fading so that it does not depend on input delta Change NodeOneShot fading so that it does not depend on input delta Jan 19, 2025
@TokageItLab TokageItLab changed the title Change NodeOneShot fading so that it does not depend on input delta Change NodeOneShot fading to uses self delta instead of input delta Jan 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Ready for review
Development

Successfully merging this pull request may close these issues.

OneShots can't fade out StateMachine shots with no running animation
1 participant