From 64d53d1fabc4aa9d2fcad9c7506ce9dc78b26ec8 Mon Sep 17 00:00:00 2001 From: nvsickle Date: Mon, 10 May 2021 15:53:11 -0700 Subject: [PATCH] Fix View::GetCameraTransform --- Gems/Atom/RPI/Code/Source/RPI.Public/View.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Gems/Atom/RPI/Code/Source/RPI.Public/View.cpp b/Gems/Atom/RPI/Code/Source/RPI.Public/View.cpp index 85216707a8..21a46693d5 100644 --- a/Gems/Atom/RPI/Code/Source/RPI.Public/View.cpp +++ b/Gems/Atom/RPI/Code/Source/RPI.Public/View.cpp @@ -112,10 +112,10 @@ namespace AZ AZ::Transform View::GetCameraTransform() const { - const Quaternion zUpToYUp = Quaternion::CreateRotationX(-AZ::Constants::HalfPi); + static const Quaternion yUpToZUp = Quaternion::CreateRotationX(-AZ::Constants::HalfPi); return AZ::Transform::CreateFromQuaternionAndTranslation( - Quaternion::CreateFromMatrix4x4(m_worldToViewMatrix) * zUpToYUp, - m_worldToViewMatrix.GetTranslation() + Quaternion::CreateFromMatrix4x4(m_viewToWorldMatrix) * yUpToZUp, + m_viewToWorldMatrix.GetTranslation() ).GetOrthogonalized(); } @@ -127,7 +127,7 @@ namespace AZ // is in a Z-up world and an identity matrix means that it faces along the positive-Y axis and Z is up. // An identity view matrix on the other hand looks along the negative Z-axis. // So we adjust for this by rotating the camera world matrix by 90 degrees around the X axis. - AZ::Matrix3x4 zUpToYUp = AZ::Matrix3x4::CreateRotationX(AZ::Constants::HalfPi); + static AZ::Matrix3x4 zUpToYUp = AZ::Matrix3x4::CreateRotationX(AZ::Constants::HalfPi); AZ::Matrix3x4 yUpWorld = cameraTransform * zUpToYUp; float viewToWorldMatrixRaw[16] = {