aboutsummaryrefslogtreecommitdiff
path: root/scene/animation/animation_player.cpp
diff options
context:
space:
mode:
authorPedro J. Estébanez2017-11-13 12:46:30 +0100
committerPedro J. Estébanez2017-11-13 12:49:31 +0100
commite477fa2bd2d6cca37540e1c0791288f52bbb50b2 (patch)
tree7adfbfe67c870622a89a4467fdaae39587135205 /scene/animation/animation_player.cpp
parent2fce0010f0d0eb2476028ed62335508bceabd820 (diff)
downloadgodot-e477fa2bd2d6cca37540e1c0791288f52bbb50b2.tar.gz
godot-e477fa2bd2d6cca37540e1c0791288f52bbb50b2.tar.zst
godot-e477fa2bd2d6cca37540e1c0791288f52bbb50b2.zip
Diffstat (limited to 'scene/animation/animation_player.cpp')
-rw-r--r--scene/animation/animation_player.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/scene/animation/animation_player.cpp b/scene/animation/animation_player.cpp
index 80b774807..6be3ff88d 100644
--- a/scene/animation/animation_player.cpp
+++ b/scene/animation/animation_player.cpp
@@ -545,7 +545,14 @@ void AnimationPlayer::_animation_process_data(PlaybackData &cd, float p_delta, f
} else {
- next_pos = Math::fposmod(next_pos, len);
+ float looped_next_pos = Math::fposmod(next_pos, len);
+ if (looped_next_pos == 0 && next_pos != 0) {
+ // Loop multiples of the length to it, rather than 0
+ // so state at time=length is previewable in the editor
+ next_pos = len;
+ } else {
+ next_pos = looped_next_pos;
+ }
}
cd.pos = next_pos;