Added panel for box collider and created first rigidbody

This commit is contained in:
Antoine Pilote
2023-03-07 21:40:33 -05:00
parent 6cbad0e13b
commit 65df50e722
13 changed files with 97 additions and 33 deletions

View File

@@ -0,0 +1,39 @@
#pragma once
#include "ComponentPanel.h"
#include <src/Scene/Components/BoxCollider.h>
#include <src/Core/FileSystem.h>
#include <src/Scene/Entities/ImGuiHelper.h>
class BoxColliderPanel : ComponentPanel {
public:
BoxColliderPanel() {}
void Draw(Nuake::Entity entity) override
{
if (!entity.HasComponent<Nuake::BoxColliderComponent>())
return;
auto& component = entity.GetComponent<Nuake::BoxColliderComponent>();
BeginComponentTable(BOX COLLIDER, Nuake::BoxColliderComponent);
{
{
ImGui::Text("Size");
ImGui::TableNextColumn();
ImGuiHelper::DrawVec3("BoxSize", &component.Size);
ImGui::TableNextColumn();
ComponentTableReset(component.Size, glm::vec3(1, 1, 1));
}
ImGui::TableNextColumn();
{
ImGui::Text("Is Trigger");
ImGui::TableNextColumn();
ImGui::Checkbox("##isTrigger", &component.IsTrigger);
ImGui::TableNextColumn();
ComponentTableReset(component.IsTrigger, false);
}
}
EndComponentTable();
}
};

View File

@@ -45,7 +45,7 @@ public:
ImGui::Text("Collision");
ImGui::TableNextColumn();
ImGui::Checkbox("#Collison", &component.HasCollisions);
ImGui::Checkbox("##Collison", &component.HasCollisions);
ImGui::TableNextColumn();
ComponentTableReset(component.HasCollisions, true);
}

View File

@@ -1399,6 +1399,11 @@ namespace Nuake {
void EditorInterface::Update(float ts)
{
if (!Engine::GetCurrentScene())
{
return;
}
auto& editorCam = Engine::GetCurrentScene()->m_EditorCamera;
editorCam->Update(ts, m_IsHoveringViewport);

View File

@@ -15,6 +15,7 @@ EditorSelectionPanel::EditorSelectionPanel()
mQuakeMapPanel = QuakeMapPanel();
mCameraPanel = CameraPanel();
mRigidbodyPanel = RigidbodyPanel();
mBoxColliderPanel = BoxColliderPanel();
}
void EditorSelectionPanel::ResolveFile(Ref<Nuake::File> file)
@@ -98,6 +99,7 @@ void EditorSelectionPanel::DrawEntity(Nuake::Entity entity)
mQuakeMapPanel.Draw(entity);
mCameraPanel.Draw(entity);
mRigidbodyPanel.Draw(entity);
mBoxColliderPanel.Draw(entity);
/*
if (Selection.Entity.HasComponent<MeshComponent>())

View File

@@ -1,7 +1,9 @@
#pragma once
#include "../Actions/EditorSelection.h"
#include "src/Scene/Entities/Entity.h"
#include "src/Core/FileSystem.h"
#include <src/Resource/Project.h>
#include "../ComponentsPanel/TransformPanel.h"
#include "../ComponentsPanel/LightPanel.h"
@@ -10,9 +12,7 @@
#include "../ComponentsPanel/QuakeMapPanel.h"
#include "../ComponentsPanel/CameraPanel.h"
#include "../ComponentsPanel/RigidbodyPanel.h"
#include "../Actions/EditorSelection.h"
#include <src/Resource/Project.h>
#include "../ComponentsPanel/BoxColliderPanel.h"
class EditorSelectionPanel {
private:
@@ -23,9 +23,11 @@ private:
QuakeMapPanel mQuakeMapPanel;
CameraPanel mCameraPanel;
RigidbodyPanel mRigidbodyPanel;
BoxColliderPanel mBoxColliderPanel;
Ref<Nuake::File> currentFile;
Ref<Nuake::Resource> selectedResource;
public:
EditorSelectionPanel();