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

[ENHANCEMENT/BUGFIX] MathUtil additions + lerp fix #3617

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from

Conversation

cyn0x8
Copy link
Contributor

@cyn0x8 cyn0x8 commented Oct 8, 2024

changes:

  • corrected errors in documentation for the non-deprecated functions
  • moved deprecated functions to the bottom
  • added helper functions fract and snap
  • deprecated smoothLerp and split it into smoothLerpDecay and smoothLerpPrecision (the halfLife and duration/precision versions respectively)
  • converted all uses of smoothLerp and coolLerp to (functionally identical) smoothLerpPrecision along with snap for stuff like the score numbers
  • added @:keep to the class so that while source may not use all the functions, mods will still be able to

explanation:

i like fract

also!!! the behavior of smoothLerp is incorrect... more precisely the snapping

it assumes the "origin" value is 0, which leads to this behavior:

2024-10-06.20-02-02.mp4

which can be fixed if (precision * target) is changed to precision * Math.abs(target - base)!!

2024-10-06.20-35-53.mp4

...HOWEVER
this only works for the first iteration as the base changes and thus the threshold changes
you cant snap the value after duration because its literally impossible to obtain that information without some extra variable keeping track of the "origin" value

sooo i split off the snapping behavior into its own function and made the threshold constant, separate for each use case like 1 for the song score or 0.01 for the song % completed

@github-actions github-actions bot added large A large pull request with more than 100 changes haxe Issue/PR modifies game code and removed large A large pull request with more than 100 changes labels Oct 8, 2024
@cyn0x8
Copy link
Contributor Author

cyn0x8 commented Oct 8, 2024

everything is pretty much identical, except for the score lerp on freeplay which now goes to the last digit

2024-10-07.17-54-04.mp4

@EliteMasterEric EliteMasterEric added the status: pending triage The bug or PR has not been reviewed yet. label Oct 8, 2024
@github-actions github-actions bot added large A large pull request with more than 100 changes and removed large A large pull request with more than 100 changes labels Oct 11, 2024
@github-actions github-actions bot added large A large pull request with more than 100 changes and removed large A large pull request with more than 100 changes labels Oct 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
haxe Issue/PR modifies game code status: pending triage The bug or PR has not been reviewed yet.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants