diff --git a/CENTRAL 3D/Source/GameObject.cpp b/CENTRAL 3D/Source/GameObject.cpp index c1ce08e10..d2097a819 100644 --- a/CENTRAL 3D/Source/GameObject.cpp +++ b/CENTRAL 3D/Source/GameObject.cpp @@ -42,8 +42,13 @@ std::string GameObject::GetName() const float3 GameObject::GetPosition() { float3 position; - Local_transform.TransformPos(position); - Local_transform.TranslatePart(); + /*Local_transform.TransformPos(position); + Local_transform.TranslatePart();*/ + + position.x = Local_transform.ptr()[12]; + position.y = Local_transform.ptr()[13]; + position.z = Local_transform.ptr()[14]; + return position; } diff --git a/CENTRAL 3D/Source/PanelInspector.cpp b/CENTRAL 3D/Source/PanelInspector.cpp index be39bdd4e..e245e5a79 100644 --- a/CENTRAL 3D/Source/PanelInspector.cpp +++ b/CENTRAL 3D/Source/PanelInspector.cpp @@ -1,6 +1,10 @@ #include "PanelInspector.h" #include "Imgui/imgui.h" +#include "Application.h" +#include "ModuleSceneManager.h" + +#include "GameObject.h" #include "mmgr/mmgr.h" @@ -19,7 +23,49 @@ bool PanelInspector::Draw() if (ImGui::Begin(name, &enabled, settingsFlags)) { + GameObject* Selected = App->scene_manager->GetGameObjects().at(App->scene_manager->GetSelectedGameObjects()); + + ImGui::SetNextItemOpen(true); + + if (ImGui::TreeNode("Transform")) + { + + // --- Transform --- + float3 position = Selected->GetPosition(); + ImGui::Text("X"); + ImGui::SameLine(); + ImGui::SetNextItemWidth(100.0f); + + ImGui::DragFloat(" ", &position.x, 0.005f); + + ImGui::SameLine(); + + ImGui::Text("Y"); + ImGui::SameLine(); + ImGui::SetNextItemWidth(100.0f); + + ImGui::DragFloat(" ", &position.y, 0.005f); + + ImGui::SameLine(); + + ImGui::Text("Z"); + ImGui::SameLine(); + ImGui::SetNextItemWidth(100.0f); + + ImGui::DragFloat(" ", &position.z, 0.005f); + + Selected->SetPosition(position.x, position.y, position.z); + + ImGui::TreePop(); + } + + ImGui::Separator(); + + + if (Selected->GetComponent(Component::ComponentType::Mesh)) + { + } } ImGui::End();