Hello Spine team,
I am implementing spine-cpp version 4.2 in a custom engine, and I believe I'm encountering a runtime error.
We are using AnimationState::setEmptyAnimations(0.0f)
to immediately stop playing all animations and return to the setup pose in certain cases.
Shortly after setting the animation to empty, we experience a crash after we update the object with AnimationState::apply
when we get to AnimationState::queueEvents
:
void AnimationState::queueEvents(TrackEntry *entry, float animationTime) {
float animationStart = entry->_animationStart, animationEnd = entry->_animationEnd;
float duration = animationEnd - animationStart; // <<- Can be 0 for an empty animation?
float trackLastWrapped = MathUtil::fmod(entry->_trackLast, duration); // mod by 0 occurs here, crashes here
I think it makes sense that the duration of the animation is 0, as the documentation mentions that setEmptyAnimation
creates an animation with a duration of zero specifically :
https://en.esotericsoftware.com/spine-api-reference#AnimationState-setEmptyAnimation
In this case, should AnimationState::queueEvents
not be calling in AnimationState::apply
when the duration is 0? Or should queueEvents
early out?
Thanks for your help!