From 614b3b3ca1c7ff6c67999bf7837ea6eee1fda530 Mon Sep 17 00:00:00 2001 From: Antoine Pilote Date: Wed, 12 Jul 2023 21:47:09 -0400 Subject: [PATCH] Fixed flipping when loading --- Nuake/src/Scene/Systems/TransformSystem.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/Nuake/src/Scene/Systems/TransformSystem.cpp b/Nuake/src/Scene/Systems/TransformSystem.cpp index 5ea67f1f..86d9ceb8 100644 --- a/Nuake/src/Scene/Systems/TransformSystem.cpp +++ b/Nuake/src/Scene/Systems/TransformSystem.cpp @@ -56,11 +56,10 @@ namespace Nuake { auto& localTranslate = transform.GetLocalPosition(); auto& localRot = transform.GetLocalRotation(); auto& localScale = transform.GetLocalScale(); - + localRot.w *= -1.0; localTransform = glm::translate(localTransform, localTranslate); localTransform = localTransform * glm::toMat4(localRot); localTransform = glm::scale(localTransform, localScale); - transform.SetLocalTransform(localTransform); transform.Dirty = false; } @@ -94,10 +93,10 @@ namespace Nuake { { TransformComponent& transformComponent = parentComponent.Parent.GetComponent(); + globalPosition = transformComponent.GetLocalPosition() + (transformComponent.GetLocalRotation() * globalPosition); globalTransform = transformComponent.GetLocalTransform() * globalTransform; - globalPosition += transformComponent.GetLocalPosition(); - globalOrientation *= transformComponent.GetLocalRotation(); + globalOrientation = transformComponent.GetLocalRotation() * globalOrientation; globalScale *= transformComponent.GetLocalScale(); NameComponent& nameComponent = parentComponent.Parent.GetComponent();