From 9bdaea10f55d72e0ec6e68a33f638c9c1ec3a389 Mon Sep 17 00:00:00 2001 From: Diren D Bharwani Date: Wed, 23 Nov 2022 16:56:25 +0800 Subject: [PATCH] Fixed...another..bug...:( --- SHADE_Application/src/Scenes/SBMainScene.cpp | 8 ++++++-- SHADE_Engine/src/Physics/System/SHPhysicsSystem.cpp | 8 +++++++- SHADE_Engine/src/Physics/System/SHPhysicsSystem.h | 2 +- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/SHADE_Application/src/Scenes/SBMainScene.cpp b/SHADE_Application/src/Scenes/SBMainScene.cpp index 521dd275..73926115 100644 --- a/SHADE_Application/src/Scenes/SBMainScene.cpp +++ b/SHADE_Application/src/Scenes/SBMainScene.cpp @@ -44,8 +44,6 @@ namespace Sandbox { sceneName = SHSerialization::DeserializeSceneFromFile(sceneAssetID); - #ifndef SHEDITOR - auto* physicsSystem = SHSystemManager::GetSystem(); if (!physicsSystem) { @@ -53,6 +51,12 @@ namespace Sandbox return; } + #ifdef SHEDITOR + + physicsSystem->ForceBuild(SHSceneManager::GetCurrentSceneGraph()); + + #else + physicsSystem->BuildScene(SHSceneManager::GetCurrentSceneGraph()); #endif diff --git a/SHADE_Engine/src/Physics/System/SHPhysicsSystem.cpp b/SHADE_Engine/src/Physics/System/SHPhysicsSystem.cpp index 9eab928d..061b7b26 100644 --- a/SHADE_Engine/src/Physics/System/SHPhysicsSystem.cpp +++ b/SHADE_Engine/src/Physics/System/SHPhysicsSystem.cpp @@ -188,6 +188,13 @@ namespace SHADE objectManager.UpdateCommands(); } + void SHPhysicsSystem::ForceBuild(SHSceneGraph& sceneGraph) + { + // HACK: Band-aid fix. To be removed. + objectManager.UpdateCommands(); + } + + void SHPhysicsSystem::ForceUpdate() { if (!worldState.world) @@ -419,7 +426,6 @@ namespace SHADE for (size_t i = 0; i < COLLIDER->GetCollisionShapes().size(); ++i) objectManager.AddCollisionShape(EID, i); } - }; //////////////////////////////// diff --git a/SHADE_Engine/src/Physics/System/SHPhysicsSystem.h b/SHADE_Engine/src/Physics/System/SHPhysicsSystem.h index f7340d31..8d49450d 100644 --- a/SHADE_Engine/src/Physics/System/SHPhysicsSystem.h +++ b/SHADE_Engine/src/Physics/System/SHPhysicsSystem.h @@ -78,9 +78,9 @@ namespace SHADE void Exit () override; void BuildScene (SHSceneGraph& sceneGraph); + void ForceBuild (SHSceneGraph& sceneGraph); void ForceUpdate (); - /** * @brief Casts a ray into the world. * @param ray The ray to cast. -- 2.40.1