From ab2cfe89ce6531d4cb060f853c8b242183c8256c Mon Sep 17 00:00:00 2001 From: Wojtek Figat Date: Wed, 10 May 2023 12:47:59 +0200 Subject: [PATCH] Fix looping animation in Anim Graph when using start position offset --- Source/Engine/Animations/Graph/AnimGroup.Animation.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Source/Engine/Animations/Graph/AnimGroup.Animation.cpp b/Source/Engine/Animations/Graph/AnimGroup.Animation.cpp index c80d27b54..c508ab3c8 100644 --- a/Source/Engine/Animations/Graph/AnimGroup.Animation.cpp +++ b/Source/Engine/Animations/Graph/AnimGroup.Animation.cpp @@ -169,13 +169,15 @@ float GetAnimPos(float& timePos, float startTimePos, bool loop, float length) { // Animation looped result = Math::Mod(result, length); + + // Remove start time offset to properly loop from animation start during the next frame + timePos = result - startTimePos; } else { // Animation ended - result = length; + timePos = result = length; } - timePos = result; } return result; }