From 216a5fdbd0cc4d01bad28afb868f0a781c95a55a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Martin=20=C5=A0toura=C4=8D?= <525032@mail.muni.cz>
Date: Sat, 18 May 2024 11:30:43 +0200
Subject: [PATCH] fix ui of Body A rotation angle

---
 src/gui/src/ui.cpp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/gui/src/ui.cpp b/src/gui/src/ui.cpp
index a1415f6..ee8affd 100644
--- a/src/gui/src/ui.cpp
+++ b/src/gui/src/ui.cpp
@@ -796,6 +796,7 @@ void component_rotation_ui(const osi::Window &window, edit::UIData &data)
         auto rotated_angle_rad = glm::orientedAngle(glm::vec3(0.0f, 1.0f, 0.0f), voxel_y_axis, glm::vec3(0.0f, 0.0f, 1.0f));
 
         current_rotation = voxel_y_axis.z < 0.0f ? -glm::degrees(rotated_angle_rad) : glm::degrees(rotated_angle_rad);
+        current_rotation = component_info == "Body A" ? -current_rotation : current_rotation;
     }
     prev_rotation = current_rotation;
 
@@ -826,7 +827,7 @@ void component_rotation_ui(const osi::Window &window, edit::UIData &data)
 
     ImGui::End();
 
-    data.component_rotation_angle = current_rotation - prev_rotation;
+    data.component_rotation_angle = component_info == "Body A" ? prev_rotation - current_rotation : current_rotation - prev_rotation;
     data.is_rotating_component = data.component_rotation_angle != 0;
 }
 
-- 
GitLab