Skip to content

Commit 521d167

Browse files
committed
make sure no keyframes are ignored when exporting animation curves
- if lasttime * samplerate = 30.99999, then the last frame will be 30 even though it should be 31
1 parent e00392b commit 521d167

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Assets/FbxExporters/Editor/FbxExporter.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1431,8 +1431,8 @@ public static HashSet<float> GetSampleTimes(AnimationCurve[] animCurves, double
14311431
lastTime = System.Math.Max(lastTime, ac[ac.length-1].time);
14321432
}
14331433

1434-
int firstframe = (int)(firstTime * sampleRate);
1435-
int lastframe = (int)(lastTime * sampleRate);
1434+
int firstframe = (int)System.Math.Floor(firstTime * sampleRate);
1435+
int lastframe = (int)System.Math.Ceiling(lastTime * sampleRate);
14361436
for (int i = firstframe; i <= lastframe; i++) {
14371437
keyTimes.Add ((float)(i * fs));
14381438
}

0 commit comments

Comments
 (0)