From 619f71cc19880c1a18a46975db5cc415898dbd09 Mon Sep 17 00:00:00 2001 From: greerdv Date: Tue, 11 May 2021 11:39:14 +0100 Subject: [PATCH] fixing some bugs with debug draw not taking entity scale into account --- .../AtomDebugDisplayViewportInterface.cpp | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/Gems/AtomLyIntegration/AtomBridge/Code/Source/AtomDebugDisplayViewportInterface.cpp b/Gems/AtomLyIntegration/AtomBridge/Code/Source/AtomDebugDisplayViewportInterface.cpp index 7a8d6b7494..1039a12622 100644 --- a/Gems/AtomLyIntegration/AtomBridge/Code/Source/AtomDebugDisplayViewportInterface.cpp +++ b/Gems/AtomLyIntegration/AtomBridge/Code/Source/AtomDebugDisplayViewportInterface.cpp @@ -931,13 +931,14 @@ namespace AZ::AtomBridge { if (m_auxGeomPtr) { + const float scale = GetCurrentTransform().RetrieveScale().GetMaxElement(); const AZ::Vector3 worldCenter = ToWorldSpacePosition(center); const AZ::Vector3 worldAxis = ToWorldSpaceVector(axis); m_auxGeomPtr->DrawCylinder( worldCenter, worldAxis, - radius, - height, + scale * radius, + scale * height, m_rendState.m_color, AZ::RPI::AuxGeomDraw::DrawStyle::Line, m_rendState.m_depthTest, @@ -957,13 +958,14 @@ namespace AZ::AtomBridge { if (m_auxGeomPtr) { + const float scale = GetCurrentTransform().RetrieveScale().GetMaxElement(); const AZ::Vector3 worldCenter = ToWorldSpacePosition(center); const AZ::Vector3 worldAxis = ToWorldSpaceVector(axis); m_auxGeomPtr->DrawCylinder( worldCenter, worldAxis, - radius, - height, + scale * radius, + scale * height, m_rendState.m_color, drawShaded ? AZ::RPI::AuxGeomDraw::DrawStyle::Shaded : AZ::RPI::AuxGeomDraw::DrawStyle::Solid, m_rendState.m_depthTest, @@ -1067,10 +1069,10 @@ namespace AZ::AtomBridge { if (m_auxGeomPtr) { - + const float scale = GetCurrentTransform().RetrieveScale().GetMaxElement(); m_auxGeomPtr->DrawSphere( ToWorldSpacePosition(pos), - radius, + scale * radius, m_rendState.m_color, AZ::RPI::AuxGeomDraw::DrawStyle::Line, m_rendState.m_depthTest, @@ -1161,12 +1163,13 @@ namespace AZ::AtomBridge { if (m_auxGeomPtr) { + const float scale = GetCurrentTransform().RetrieveScale().GetMaxElement(); const AZ::Vector3 worldPos = ToWorldSpacePosition(pos); const AZ::Vector3 worldDir = ToWorldSpaceVector(dir); m_auxGeomPtr->DrawDisk( worldPos, worldDir, - radius, + scale * radius, m_rendState.m_color, AZ::RPI::AuxGeomDraw::DrawStyle::Shaded, m_rendState.m_depthTest,