summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJonathan Bradley <jcb@pikum.xyz>2023-11-22 16:17:00 -0500
committerJonathan Bradley <jcb@pikum.xyz>2023-11-22 16:17:00 -0500
commitebcdf969c2388e97aee6ac3cde83510aab3e3238 (patch)
treea09ee7c67a3e50dd06126107a0a20ea2209a4e5f /src
parent8ac7e449808aef8b0972d37d943da0765d081547 (diff)
expose rot as eul degrees in editor
Diffstat (limited to 'src')
-rw-r--r--src/game.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/game.cpp b/src/game.cpp
index bb4bbd6..f1398eb 100644
--- a/src/game.cpp
+++ b/src/game.cpp
@@ -1041,10 +1041,13 @@ void RecordImGui_CompInstPos(bool readonly, CompInstance *component) {
btVector3 pos = instPos.posRot.getOrigin();
btQuaternion rot = instPos.posRot.getRotation();
+ glm::vec3 eul;
+ rot.getEulerZYX(eul.z, eul.y, eul.x);
+ eul = glm::degrees(eul);
changed = ImGui::InputScalar("Instance Index", ImGuiDataType_U64, &component->index, nullptr, nullptr, nullptr, ImGuiInputTextFlags_ReadOnly) || changed;
changed = ImGui::InputScalarN("pos", ImGuiDataType_Float, &pos, 3, nullptr, nullptr, nullptr, inputTextFlags) || changed;
- changed = ImGui::InputScalarN("rot", ImGuiDataType_Float, &rot, 4, nullptr, nullptr, nullptr, inputTextFlags) || changed;
+ changed = ImGui::InputScalarN("rot (eul)", ImGuiDataType_Float, &eul, 3, nullptr, nullptr, nullptr, inputTextFlags) || changed;
changed = ImGui::InputScalarN("scale", ImGuiDataType_Float, &instPos.scale, 3, nullptr, nullptr, nullptr, inputTextFlags) || changed;
changed = ImGui::InputFloat("mass", &instPos.mass, 0.0, 0.0, "%.3f", inputTextFlags) || changed;
@@ -1056,6 +1059,8 @@ void RecordImGui_CompInstPos(bool readonly, CompInstance *component) {
if (changed) {
instPos.posRot.setOrigin(pos);
+ eul = glm::radians(eul);
+ rot.setEulerZYX(eul.z, eul.y, eul.x);
instPos.posRot.setRotation(rot);
auto *broadphase = component->bt.rigidBody->getBroadphaseProxy();
broadphase->m_collisionFilterGroup = static_cast<PhysicsCollision_T>(component->physicsLayer);