From e4f048d67c171c34995763519e6d21bf40df29a7 Mon Sep 17 00:00:00 2001 From: Relintai Date: Sun, 17 May 2020 16:21:00 +0200 Subject: [PATCH] Fix key_step calculation. --- procedural_animation.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/procedural_animation.cpp b/procedural_animation.cpp index cbaba68..a14c795 100644 --- a/procedural_animation.cpp +++ b/procedural_animation.cpp @@ -244,7 +244,8 @@ void ProceduralAnimation::process_animation_data() { } float target_keyframe_time = 0; - float key_step = _animation->get_length() / static_cast(_animation_fps); + float key_step = 1.0 / static_cast(_animation_fps); + int next_animation_key = _start_frame_index; Vector _used_keys; while (next_animation_key != -1) { @@ -256,7 +257,7 @@ void ProceduralAnimation::process_animation_data() { int animation_keyframe_index = frame->animation_keyframe_index; - float time = animation_keyframe_index * key_step; + float time = static_cast(animation_keyframe_index) * key_step; bool found_keyframe = false; for (int i = 0; i < _animation->get_track_count(); ++i) {