diff --git a/src/k3.c b/src/k3.c index d9241cb..ac58d0e 100644 --- a/src/k3.c +++ b/src/k3.c @@ -404,6 +404,11 @@ static void anim_update(struct k3Animator *anim) { void k3AnimatorSet(struct k3Animator *anim, float time) { if(!anim->inter) anim->inter = _mm_malloc(sizeof(mat4) * anim->base->boneCount * anim->base->frameCount, 16); + if(!anim->loop) { + time = fmaxf(time, 0); + time = fminf(time, (float) (anim->base->frameCount - 1) / anim->base->fps); + } + anim->time = time; anim_update(anim);