Fixed bug where animations would revert to bind pose when paused

This commit is contained in:
Kah Wei 2023-03-10 18:57:09 +08:00
parent e531a087f6
commit d1e1a2e31c
1 changed files with 6 additions and 2 deletions

View File

@ -124,9 +124,13 @@ namespace SHADE
std::fill(boneMatrices.begin(), boneMatrices.end(), SHMatrix::Identity); std::fill(boneMatrices.begin(), boneMatrices.end(), SHMatrix::Identity);
// Do not do anything if is not playing or there's nothing to animate // Do not do anything if is not playing or there's nothing to animate
if (!isPlaying || !rig || !rig->GetRootNode()) if (!rig || !rig->GetRootNode())
return; return;
// We want to still display a paused pose, so we only prevent progression
if (!isPlaying)
dt = 0.0f;
// Update the animation controller if any, this will set the currClip // Update the animation controller if any, this will set the currClip
if (animController) if (animController)
{ {
@ -270,7 +274,7 @@ namespace SHADE
void SHAnimatorComponent::updateCurrentAnimatorState(Handle<SHAnimationClip> clip, float playbackTime) void SHAnimatorComponent::updateCurrentAnimatorState(Handle<SHAnimationClip> clip, float playbackTime)
{ {
// Nothing to animate // Nothing to animate
if (!clip || !isPlaying || !rig || !rig->GetRootNode()) if (!clip || !rig || !rig->GetRootNode())
return; return;
// Check that we have animation data // Check that we have animation data