Does Changing Play Speed Skip Frames?
I am dealing with a bug in which (it seems) some key frames are skipped. This leads to the incorrect images being displayed/not being switched too and events not firing.
How long the animation plays for changes so we do something like:
m_PlaySpeed = m_AnimDuration/m_MaxAnimTime;
where m_AnimDuration
is got from the animations duration spine runtime. We update them_PlaySpeed
(a.k.a. entries time scale), slowing down/speeding up the animation as needed.
It seems strange that the animation would be skipping frames as the m_PlaySpeed
is never greater than 1.
It also seems to be the last few keys it is missing, although I could be wrong, as more often than not we speed up the play speed. so the further the key frame is in the animation the more likely it will be skipped.
Its also worth noting that if we don't change m_PlaySped
only calculate it once, and set it at start of animation (before any animation updates) it does not skip the frame(s)
After some investigating, it seems events don't fire on the last frame if the time scale is ~<0.05 and on second to last frame if the time scale is ~<0.04 (based on a 15 frame animation). I am pretty confident it is the time scale which is causing this issue now. How to fix it is a different matter though :/
ok, I have solved this now. The problem was I was not waiting for the animation to end, I would play the animation as soon as the timer said the animation should be over. Because of order of operations, this meant the animation would change to the new animation that update, thus the last keyframe never played. I have changed it to wait until the animation is over before switching the animation
Thanks to BinaryCats for all the help 😉