Created
January 17, 2018 07:33
-
-
Save LordNed/f18822b229c9488795af4a249e0c8e82 to your computer and use it in GitHub Desktop.
J3DAnimFix
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ToDo: This fixes the OoB issue when an animation doesn't have a key on the final frame, | |
// but this isn't totally correct as the time calculation below doesn't take the shifted | |
// t value into account. | |
int i = 1; | |
while (keys[i].Time < t) | |
{ | |
i++; | |
if (i >= keys.Count) | |
{ | |
i = 1; | |
break; | |
} | |
} | |
float time = (t - keys[i - 1].Time) / (keys[i].Time - keys[i - 1].Time); // Scale to [0, 1] | |
return CubicInterpolation(keys[i - 1], keys[i], time); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment