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

[AnimationPlayer] Discrepancy between 'current_animation_position' and 'current_animation_length' when animation is finished #95021

Closed
LakshayaG73 opened this issue Aug 1, 2024 · 5 comments · Fixed by #95023

Comments

@LakshayaG73
Copy link

Tested versions

4.3 rc 1

System information

Windows 11

Issue description

There is a slight discrepancy in the properties 'current_animation_position' and 'current_animation_length' of AnimationPlayer when an animation has finished playing.

These properties should be equal, and this was the behavior in the previous 4.3 beta 3.

Steps to reproduce

Create an animation in AnimationPlayer, of any arbitrary length.

In your process function, check if the position of the animation is equal to the length of the animation.

This value will always be false, even after the animation has finished.

Minimal reproduction project (MRP)

broken-animations.zip

@akien-mga
Copy link
Member

Probably caused by the approximate comparisons added recently.

@TokageItLab
Copy link
Member

Since approximation should be used as the comparison method in most cases, so I believe the correct direction is to fix that cases where exact matching should be assumed, such as finished, to snap current_position to animation_length instead of using exactness in the comparison method.

@LakshayaG73
Copy link
Author

does this bug also affect the finished signal?

@TokageItLab
Copy link
Member

TokageItLab commented Aug 1, 2024

I sent #95023, check it if you can.

One possible change from 4.2 is that the end signal will be given only one frame earlier (in cases where there is a decimal point error there).

However, this means that prior to 4.2, Animation was only advancing the animation by a decimal point error at the end of the animation, meaning that there was one frame at the end of the animation where no change actually occurred. So now the signal should be fired on more accurate timing as end of the animation.

@LakshayaG73
Copy link
Author

The original issue seems to be fixed with this PR.

It fixes this scenario and I don't see any other issues for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants