Added Cylinder Collider panel

This commit is contained in:
Antoine Pilote
2023-07-15 19:26:58 -04:00
parent dbac1c187f
commit fa2d8d3ce9
2 changed files with 46 additions and 1 deletions

View File

@@ -0,0 +1,42 @@
#pragma once
#include "ComponentPanel.h"
#include <src/Scene/Components/CylinderColliderComponent.h>
class CylinderColliderPanel : ComponentPanel
{
public:
CylinderColliderPanel() = default;
void Draw(Nuake::Entity entity) override
{
using namespace Nuake;
if (!entity.HasComponent<CylinderColliderComponent>())
{
return;
}
auto& [Cylinder, Radius, Height, IsTrigger] = entity.GetComponent<CylinderColliderComponent>();
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()
}
};

View File

@@ -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);
}