Fix looping animation in Anim Graph when using start position offset

This commit is contained in:
Wojtek Figat
2023-05-10 12:47:59 +02:00
parent aab3d494ff
commit ab2cfe89ce

View File

@@ -169,13 +169,15 @@ float GetAnimPos(float& timePos, float startTimePos, bool loop, float length)
{ {
// Animation looped // Animation looped
result = Math::Mod(result, length); result = Math::Mod(result, length);
// Remove start time offset to properly loop from animation start during the next frame
timePos = result - startTimePos;
} }
else else
{ {
// Animation ended // Animation ended
result = length; timePos = result = length;
} }
timePos = result;
} }
return result; return result;
} }