Explorar o código

[lua] Ported new fix for 0 timeScale not returning to setup pose. See #1194.

badlogic %!s(int64=6) %!d(string=hai) anos
pai
achega
d71d5a390e
Modificáronse 1 ficheiros con 3 adicións e 10 borrados
  1. 3 10
      spine-lua/AnimationState.lua

+ 3 - 10
spine-lua/AnimationState.lua

@@ -249,11 +249,11 @@ function AnimationState:update (delta)
 					local nextTime = current.trackLast - _next.delay
 					if nextTime >= 0 then
 						_next.delay = 0
-						_next.trackTime = nextTime + delta * _next.timeScale
+						_next.trackTime = (nextTime / current.timeScale + delta) * _next.timeScale
 						current.trackTime = current.trackTime + currentDelta
 						self:setCurrent(i, _next, true)
 						while _next.mixingFrom do
-							_next.mixTime = _next.mixTime + currentDelta
+							_next.mixTime = _next.mixTime + delta
 							_next = _next.mixingFrom
 						end
 						skip = true
@@ -310,15 +310,8 @@ 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
+	to.mixTime = to.mixTime + delta
 	return false;
 end