Fixed quaternion for transforms

This commit is contained in:
a.pilote
2022-07-13 20:27:32 -04:00
parent a4cdf4b524
commit fb6080d734
5 changed files with 27 additions and 26 deletions

View File

@@ -7,10 +7,15 @@ namespace Nuake
{
GlobalTranslation = Vector3(0, 0, 0);
Translation = Vector3(0, 0, 0);
Orientation = Quat(0, 0, 0, 0);
GlobalOrientation = Orientation;
//Rotation = Vector3(0, 0, 0);
Scale = Vector3(1, 1, 1);
Rotation = Quat(0, 0, 0, 1);
GlobalRotation = Rotation;
GlobalScale = Vector3(1, 1, 1);
Scale = GlobalScale;
LocalTransform = Matrix4(1);
GlobalTransform = Matrix4(1);
}
void TransformComponent::SetRotation(float x, float y, float z)
@@ -19,12 +24,12 @@ namespace Nuake
Quat QuatAroundY = Quat(0.0, 1.0, 0.0, y);
Quat QuatAroundZ = Quat(0.0, 0.0, 1.0, z);
Quat finalOrientation = QuatAroundX * QuatAroundY * QuatAroundZ;
Orientation = finalOrientation;
Rotation = finalOrientation;
}
Matrix4 TransformComponent::GetGlobalTransform() const
{
return LocalTransform;
return GlobalTransform;
}
Matrix4 TransformComponent::GetLocalTransform() const