# How do I pause a single bone with spine?

I'm using spine along with SFML. I have a character that is always animated. When he shots, I set an animation that affects only his arm. The arm goes up, but I need to stop this animation in the last frame while he keeps shooting.

I use this to make him walk

AnimationState_setAnimationByName(drawable->state, 0, "walk", true);


And this to make him shot

AnimationState_setAnimationByName(drawable->state, 1, "rshot", false);


I can't find a way in Spine c runtime to make this.

I could resolve this if I find a way to update manually tracks 0 and 1, instead of the full animation.

• The last parameter, indicates to loop or not. So sending false, should technically stop the animation at the last frame. – jgallant Sep 30 '14 at 11:27
• Jon, if I set it to false, instead of stopping at the last frame, the arm continues moving as the track "1" (that moves the arm) didn't exist (and the track 0 -walk- takes the responsability of moving it-) – freesoul Sep 30 '14 at 12:01

## 1 Answer

Finally I resolved this easily by editing the spine c runtime.

AnimationState.h

struct spTrackEntry {
spAnimationState* const state;
spTrackEntry() { stopAtEnd = false; };
int/*bool*/ stopAtEnd;
spTrackEntry* next;
spTrackEntry* previous;
spAnimation* animation;
int/*bool*/loop;
float delay, time, lastTime, endTime, timeScale;
spAnimationStateListener listener;
float mixTime, mixDuration, mix;

void* rendererObject;
};


AnimationState.c

    /* End non-looping animation when it reaches its end time and there is no next entry. */
if (!current->loop && current->lastTime >= current->endTime)
{
if (!current->stopAtEnd)
spAnimationState_clearTrack(self, i);
}


...

spTrackEntry* _spTrackEntry_create (spAnimationState* state) {
spTrackEntry* self = NEW(spTrackEntry);
CONST_CAST(spAnimationState*, self->state) = state;
self->timeScale = 1;
self->lastTime = -1;
self->mix = 1;
self->stopAtEnd = 0;
return self;
}