From 727b6ba871cdb3cb55f859f2e1cbe49b73f99aa9 Mon Sep 17 00:00:00 2001 From: sippeangelo Date: Wed, 9 Mar 2016 22:04:13 +0100 Subject: [PATCH] Fixed Transform::AbsolutePosition to take scale into account properly maybe? --- src/Engine/Core/Transform.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Engine/Core/Transform.cpp b/src/Engine/Core/Transform.cpp index 333c3532..e5cff11c 100644 --- a/src/Engine/Core/Transform.cpp +++ b/src/Engine/Core/Transform.cpp @@ -24,7 +24,7 @@ glm::vec3 Transform::AbsolutePosition(World* world, EntityID entity) while (entity != EntityID_Invalid) { ComponentWrapper transform = world->GetComponent(entity, "Transform"); EntityID parent = world->GetParent(entity); - position += Transform::AbsoluteOrientation(world, parent) * (glm::vec3)transform["Position"]; + position += Transform::AbsoluteScale(world, parent) * (Transform::AbsoluteOrientation(world, parent) * (glm::vec3)transform["Position"]); entity = parent; } @@ -89,12 +89,12 @@ glm::mat4 Transform::ModelMatrix(EntityID entity, World* world) { return AbsoluteTransformation(EntityWrapper(world, entity)); - glm::vec3 position = Transform::AbsolutePosition(world, entity); - glm::quat orientation = Transform::AbsoluteOrientation(world, entity); - glm::vec3 scale = Transform::AbsoluteScale(world, entity); + //glm::vec3 position = Transform::AbsolutePosition(world, entity); + //glm::quat orientation = Transform::AbsoluteOrientation(world, entity); + //glm::vec3 scale = Transform::AbsoluteScale(world, entity); - glm::mat4 modelMatrix = glm::translate(glm::mat4(), position) * glm::toMat4(orientation) * glm::scale(scale); - return modelMatrix; + //glm::mat4 modelMatrix = glm::translate(glm::mat4(), position) * glm::toMat4(orientation) * glm::scale(scale); + //return modelMatrix; } glm::vec3 Transform::TransformPoint(const glm::vec3& point, const glm::mat4& matrix)