From d1e1a2e31c1f27d636ca358ff02fe156ef675725 Mon Sep 17 00:00:00 2001 From: Kah Wei Date: Fri, 10 Mar 2023 18:57:09 +0800 Subject: [PATCH] Fixed bug where animations would revert to bind pose when paused --- SHADE_Engine/src/Animation/SHAnimatorComponent.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/SHADE_Engine/src/Animation/SHAnimatorComponent.cpp b/SHADE_Engine/src/Animation/SHAnimatorComponent.cpp index fb866cbb..294d8098 100644 --- a/SHADE_Engine/src/Animation/SHAnimatorComponent.cpp +++ b/SHADE_Engine/src/Animation/SHAnimatorComponent.cpp @@ -124,9 +124,13 @@ namespace SHADE std::fill(boneMatrices.begin(), boneMatrices.end(), SHMatrix::Identity); // Do not do anything if is not playing or there's nothing to animate - if (!isPlaying || !rig || !rig->GetRootNode()) + if (!rig || !rig->GetRootNode()) 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 if (animController) { @@ -270,7 +274,7 @@ namespace SHADE void SHAnimatorComponent::updateCurrentAnimatorState(Handle clip, float playbackTime) { // Nothing to animate - if (!clip || !isPlaying || !rig || !rig->GetRootNode()) + if (!clip || !rig || !rig->GetRootNode()) return; // Check that we have animation data