From 6f72049359651155be62846e7d080d7a5e871096 Mon Sep 17 00:00:00 2001 From: hachem Date: Thu, 21 Aug 2025 19:08:34 +0200 Subject: [fix]: proper scene loading --- src/States/WorldBuilderState.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'src/States/WorldBuilderState.cpp') diff --git a/src/States/WorldBuilderState.cpp b/src/States/WorldBuilderState.cpp index 63ef25c..70ef3d4 100644 --- a/src/States/WorldBuilderState.cpp +++ b/src/States/WorldBuilderState.cpp @@ -484,6 +484,18 @@ namespace Donut ImGui::Spacing(); + if (ImGui::Button("Start Simulation", ImVec2(ImGui::GetWindowWidth() - 20, 30))) + { + // Load objects from WorldBuilder scene into Engine + auto& engine = Application::Get().GetEngine(); + engine.LoadObjectsFromScene(m_Scene.objs); + + // Switch to simulation state + Application::Get().GetStateManager().SwitchToState("Simulation"); + } + + ImGui::Spacing(); + if (ImGui::Button("Back to Config", ImVec2(ImGui::GetWindowWidth() - 20, 30))) Application::Get().GetStateManager().SwitchToState("Config"); @@ -550,7 +562,6 @@ namespace Donut Object sphere(m_NewObjectPosition, m_NewObjectRadius, material); m_Scene.objs.push_back(sphere); - // Automatically select the newly created object m_SelectedObjectIndex = static_cast(m_Scene.objs.size() - 1); m_NewObjectPosition = glm::vec3(0.0f, 0.0f, 0.0f); -- cgit v1.3