[lua] Ported 0 timeScale fix, see #1194.

This commit is contained in:
badlogic 2018-10-15 16:45:42 +02:00
parent 0e2c41b491
commit 03e578642c

View File

@ -299,7 +299,7 @@ function AnimationState:updateMixingFrom (to, delta)
from.trackLast = from.nextTrackLast
-- Require mixTime > 0 to ensure the mixing from entry was applied at least once.
if (to.mixTime > 0 and (to.mixTime >= to.mixDuration or to.timeScale == 0)) then
if (to.mixTime > 0 and to.mixTime >= to.mixDuration) then
-- Require totalAlpha == 0 to ensure mixing is complete, unless mixDuration == 0 (the transition is a single frame).
if (from.totalAlpha == 0 or to.mixDuration == 0) then
to.mixingFrom = from.mixingFrom
@ -310,6 +310,13 @@ function AnimationState:updateMixingFrom (to, delta)
return finished
end
-- If to has 0 timeScale and is not the first entry, remove the mix and apply it one more time to return to the setup pose.
if to.timeScale == 0 and to.mixingTo then
to.timeScale = 1
to.mixTime = 0
to.mixDuration = 0
end
from.trackTime = from.trackTime + delta * from.timeScale
to.mixTime = to.mixTime + delta * to.timeScale
return false;