From f44e7b7a1c2a17d41a0047049428192565463e6a Mon Sep 17 00:00:00 2001 From: Kah Wei Date: Sun, 8 Jan 2023 01:43:40 +0800 Subject: [PATCH] Debug draw capsule now works with different orientations --- .../Graphics/MiddleEnd/Interface/SHDebugDrawSystem.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/SHADE_Engine/src/Graphics/MiddleEnd/Interface/SHDebugDrawSystem.cpp b/SHADE_Engine/src/Graphics/MiddleEnd/Interface/SHDebugDrawSystem.cpp index fdd21fd4..ae8c62b2 100644 --- a/SHADE_Engine/src/Graphics/MiddleEnd/Interface/SHDebugDrawSystem.cpp +++ b/SHADE_Engine/src/Graphics/MiddleEnd/Interface/SHDebugDrawSystem.cpp @@ -362,12 +362,12 @@ namespace SHADE void SHDebugDrawSystem::drawWireCapsule(LinesBatch& lineBatch, MeshBatch& meshBatch, const SHVec3& position, const SHQuaternion& rotation, float height, float radius, const SHColour& color) { // Get local axis vectors - const SHVec3 LOCAL_UP = SHVec3::Up; - const SHVec3 LOCAL_RIGHT = SHVec3::Right; - const SHVec3 LOCAL_FORWARD = SHVec3::Forward; + const SHVec3 LOCAL_UP = SHVec3::Rotate(SHVec3::Up, rotation); + const SHVec3 LOCAL_RIGHT = SHVec3::Rotate(SHVec3::Right, rotation); + const SHVec3 LOCAL_FORWARD = SHVec3::Rotate(SHVec3::Forward, rotation); // Rotate the circle - SHQuaternion circleOrientation = SHQuaternion::FromEuler(SHVec3(SHMath::DegreesToRadians(90.0), 0.0f, 0.0f)); + SHQuaternion circleOrientation = SHQuaternion::FromEuler(SHVec3(SHMath::DegreesToRadians(90.0), 0.0f, 0.0f)) * rotation; // Compute top and bottom of the cylinder const SHVec3 HALF_UP = LOCAL_UP * (height * 0.5f - radius); @@ -396,7 +396,7 @@ namespace SHADE const SHMatrix BOT_CAP_MAT = SHMatrix::Transform ( BOT_POS, - rotation * SHQuaternion::FromEuler(SHVec3(SHMath::DegreesToRadians(180.0), 0.0f, 0.0f)), + SHQuaternion::FromEuler(SHVec3(SHMath::DegreesToRadians(180.0), 0.0f, 0.0f)) * rotation, RADIUS_SCALE ); drawMesh