Pushed scene change and animator component bug fix for models without rigs
This commit is contained in:
parent
e88447bcf0
commit
33807de93d
|
@ -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: ~
|
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue