-
-
Notifications
You must be signed in to change notification settings - Fork 21.3k
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
move_and_slide compatibility breakage between 3.0 and 3.1-alpha1 #21683
Comments
You are comparing floating point numbers, while you can't expect perfect equality of two floating point values. |
I can confirm the issue, though it seems to me that it was a bug that it worked properly in 3.0.
The difference is in In 3.0:
In 3.1-alpha:
and so on and so forth. |
And yes as @groud mentions, if you actually want to lerp the value all the way down to 0 by cutting 20% each frame, you will never reach the integer 0, so you should compare to an epsilon - but I doubt that's the logic you want to go for anyway, as it means the friction takes quite some time to slow the player down to standstill. |
I think the new behaviour is correct and this was actually fixing a bug in 3.0, but as it breaks compatibility, we need to decide how to handle it properly. |
My point was about comparing floating point values in general, but indeed in that case the code also leads you to never reach the value. |
@akien-mga the old behavior was pretty broken. we are breaking compat but it was not working well before. |
As long as we document it properly, that's fine with me. @Calinou Could you add a mention to this in your 3.1 release notes as compatibility breakage? |
@akien-mga I added it to the changelog 🙂 |
Thanks, closing then. |
Godot version:
v3.1.alpha.official
OS/device including version:
Windows 10 Home, Version 1803
Issue description:
This code worked in previous versions of Godot:
But in the current version the idle animation is not played if motion.x is set to 0.
The problem also occurs with other Lerp/move_and_slide related Code, not only with animations.
For some reason, Godot doesn't realize that the value is 0.
(In another project Lerp couldn't even set the value to 0 but only to -4 for some reason, but I can't reproduce that anymore.)
Minimal reproduction project:
Bug.zip
The text was updated successfully, but these errors were encountered: