diff --git a/Assets/Scenes/Level1Scene.shade b/Assets/Scenes/Level1Scene.shade index 04f03bba..a9be3804 100644 --- a/Assets/Scenes/Level1Scene.shade +++ b/Assets/Scenes/Level1Scene.shade @@ -4841,7 +4841,7 @@ - EID: 217 Name: ===Anims=== IsActive: true - NumberOfChildren: 4 + NumberOfChildren: 5 Components: ~ Scripts: ~ - EID: 221 @@ -4919,4 +4919,23 @@ Rig: 76715962 Clip: 76715962 IsActive: true + Scripts: ~ +- EID: 216 + Name: Obj5 + IsActive: true + NumberOfChildren: 0 + Components: + Transform Component: + Translate: {x: 1.23777485, y: 0.394771248, z: -8.23628521} + Rotate: {x: -0, y: -1.57079601, z: 0} + Scale: {x: 0.318525046, y: 0.318552583, z: 0.318525046} + IsActive: true + Renderable Component: + Mesh: 138773466 + Material: 117923942 + IsActive: true + Animator Component: + Rig: 82124728 + Clip: 82124728 + IsActive: true Scripts: ~ \ No newline at end of file diff --git a/SHADE_Engine/src/Animation/SHAnimatorComponent.cpp b/SHADE_Engine/src/Animation/SHAnimatorComponent.cpp index 932a857a..71db24db 100644 --- a/SHADE_Engine/src/Animation/SHAnimatorComponent.cpp +++ b/SHADE_Engine/src/Animation/SHAnimatorComponent.cpp @@ -23,6 +23,7 @@ of DigiPen Institute of Technology is prohibited. #include "Graphics/SHVkUtil.h" #include "Graphics/MiddleEnd/Interface/SHGraphicsSystem.h" #include "ECS_Base/Managers/SHSystemManager.h" +#include "Graphics/MiddleEnd/Interface/SHMaterialInstance.h" #include "Tools/SHDebugDraw.h" namespace SHADE @@ -98,7 +99,7 @@ namespace SHADE } } - if (rig && currClip) + if (rig && rig->GetRootNode() && currClip) { updatePoseWithClip(0.0f); } @@ -109,8 +110,11 @@ namespace SHADE /*-----------------------------------------------------------------------------------*/ void SHAnimatorComponent::Update(float dt) { + //Reset matrices + std::fill(boneMatrices.begin(), boneMatrices.end(), SHMatrix::Identity); + // Nothing to animate - if (!currClip || !isPlaying || !rig) + if (!currClip || !isPlaying || !rig || !rig->GetRootNode()) return; // Update time on the playback @@ -120,12 +124,6 @@ namespace SHADE currPlaybackTime = currPlaybackTime - currClip->GetTotalTime(); } - // Reset all matrices - for (auto& mat : boneMatrices) - { - mat = SHMatrix::Identity; - } - // Play the clip updatePoseWithClip(currPlaybackTime); }