Merge pull request #48 from SHADE-DP/SP3-16-Math

SP3-16 Transform System Hotfix
This commit is contained in:
XiaoQiDigipen 2022-09-23 15:50:05 +08:00 committed by GitHub
commit 6848672899
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 13 deletions

View File

@ -66,17 +66,8 @@ namespace SHADE
for (const auto* child : node->GetChildren())
{
// Active states of entities should sync with scene nodes
const bool IS_NODE_ACTIVE = child->IsActive();
#ifdef _DEBUG
const bool IS_ENTITY_ACTIVE = SHEntityManager::GetEntityByID(child->GetEntityID())->GetActive();
SHASSERT(IS_NODE_ACTIVE == IS_ENTITY_ACTIVE, "Entity and Node active states are not synced!")
#endif
// Anything below is inactive
if (!IS_NODE_ACTIVE)
break;
const bool HAS_TRANSFORM = SHComponentManager::HasComponent<SHTransformComponent>(child->GetEntityID());
if (!HAS_TRANSFORM)
@ -84,8 +75,13 @@ namespace SHADE
auto* childTransform = SHComponentManager::GetComponent<SHTransformComponent>(child->GetEntityID());
// Only update if node in hierarchy and component are both active
const bool IS_NODE_ACTIVE = child->IsActive();
if (IS_NODE_ACTIVE && childTransform->isActive)
{
if (childTransform->dirty || HAS_PARENT_CHANGED)
UpdateTransform(*childTransform, NODE_TRANSFORM);
}
UpdateEntity(child);