Skip to content

Commit

Permalink
Fix skeletal animations not interpolating correctly when edited in ed…
Browse files Browse the repository at this point in the history
…itor
  • Loading branch information
KillzXGaming committed Mar 6, 2024
1 parent aaee3f8 commit c78463b
Showing 1 changed file with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -118,11 +118,18 @@ static CurveAnimHelper ConvertCurve(BfresAnimationTrack track, string target)
else
{
curve.Interpolation = AnimCurveType.Linear;
foreach (STKeyFrame key in track.KeyFrames)
for (int i = 0; i < track.KeyFrames.Count; i++)
{
curve.KeyFrames.Add(key.Frame, new KeyFrame()
var key = track.KeyFrames[i];

float delta = 0;
if (i < track.KeyFrames.Count - 1)
delta = track.KeyFrames[i + 1].Value - key.Value;

curve.KeyFrames.Add(key.Frame, new LinearKeyFrame()
{
Value = (float)key.Value,
Delta = delta,
});
}
}
Expand Down

0 comments on commit c78463b

Please sign in to comment.