Skip to content

Commit

Permalink
When applying animations, allow the time to be exactly equal to the d…
Browse files Browse the repository at this point in the history
…uration before taking the fmod(), so that it is possible to animate to the exact last keyframe. Without this change, trying to animate to the last keyframe wraps back to the first, which only works for animations that loop. (#8287)
  • Loading branch information
emezeske authored Nov 25, 2024
1 parent 64eb27a commit 16bab24
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion libs/gltfio/src/Animator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ size_t Animator::getAnimationCount() const {

void Animator::applyAnimation(size_t animationIndex, float time) const {
const Animation& anim = mImpl->animations[animationIndex];
time = fmod(time, anim.duration);
time = time == anim.duration ? time : fmod(time, anim.duration);
TransformManager& transformManager = *mImpl->transformManager;
transformManager.openLocalTransformTransaction();
for (const auto& channel : anim.channels) {
Expand Down

0 comments on commit 16bab24

Please sign in to comment.