From fa2d8d3ce90ff40aab2cc7a6c50512695e2bb27d Mon Sep 17 00:00:00 2001 From: Antoine Pilote Date: Sat, 15 Jul 2023 19:26:58 -0400 Subject: [PATCH] Added Cylinder Collider panel --- .../ComponentsPanel/CylinderColliderPanel.h | 42 +++++++++++++++++++ .../src/ComponentsPanel/MeshColliderPanel.h | 5 ++- 2 files changed, 46 insertions(+), 1 deletion(-) create mode 100644 Editor/src/ComponentsPanel/CylinderColliderPanel.h diff --git a/Editor/src/ComponentsPanel/CylinderColliderPanel.h b/Editor/src/ComponentsPanel/CylinderColliderPanel.h new file mode 100644 index 00000000..c5d74c2a --- /dev/null +++ b/Editor/src/ComponentsPanel/CylinderColliderPanel.h @@ -0,0 +1,42 @@ +#pragma once +#include "ComponentPanel.h" + +#include + +class CylinderColliderPanel : ComponentPanel +{ +public: + CylinderColliderPanel() = default; + + void Draw(Nuake::Entity entity) override + { + using namespace Nuake; + + if (!entity.HasComponent()) + { + return; + } + + auto& [Cylinder, Radius, Height, IsTrigger] = entity.GetComponent(); + BeginComponentTable(CYLINDER COLLIDER, CylinderColliderComponent) + { + { + ImGui::Text("Radius"); + ImGui::TableNextColumn(); + ImGui::DragFloat("##Radius", &Radius, 0.01f, 0.001f); + ImGui::TableNextColumn(); + ComponentTableReset(Radius, 0.5f) + } + ImGui::TableNextColumn(); + { + ImGui::Text("Height"); + ImGui::TableNextColumn(); + + ImGui::DragFloat("##Height", &Height, 0.01f, 0.001f); + ImGui::TableNextColumn(); + ComponentTableReset(Height, 1.0f) + } + } + EndComponentTable() + } +}; \ No newline at end of file diff --git a/Editor/src/ComponentsPanel/MeshColliderPanel.h b/Editor/src/ComponentsPanel/MeshColliderPanel.h index b0cd959f..bfbe5012 100644 --- a/Editor/src/ComponentsPanel/MeshColliderPanel.h +++ b/Editor/src/ComponentsPanel/MeshColliderPanel.h @@ -31,7 +31,10 @@ public: ImGui::Text("Model"); ImGui::TableNextColumn(); - ImGui::DragInt("##Submesh", &component.SubMesh, 0, 255); + int editorValue = component.SubMesh; + ImGui::DragInt("##Submesh", &editorValue, 0.1f, 0, 255); + component.SubMesh = editorValue; + ImGui::TableNextColumn(); ComponentTableReset(component.SubMesh, 0); }