Bug fixes and scene changes #267

Merged
glencelow merged 15 commits from PlayerController into main 2022-11-23 20:53:44 +08:00
4 changed files with 16 additions and 5 deletions
Showing only changes of commit 3dfa3c050a - Show all commits

View File

@ -44,8 +44,6 @@ namespace Sandbox
{
sceneName = SHSerialization::DeserializeSceneFromFile(sceneAssetID);
#ifndef SHEDITOR
auto* physicsSystem = SHSystemManager::GetSystem<SHPhysicsSystem>();
if (!physicsSystem)
{
@ -53,6 +51,12 @@ namespace Sandbox
return;
}
#ifdef SHEDITOR
physicsSystem->ForceBuild(SHSceneManager::GetCurrentSceneGraph());
#else
physicsSystem->BuildScene(SHSceneManager::GetCurrentSceneGraph());
#endif

View File

@ -69,7 +69,8 @@ namespace SHADE
if (gfxSystem)
{
auto WND = gfxSystem->GetWindow();
return WND->Close();
if (WND)
WND->Destroy();
}
SHLOG_WARNING("[SHGraphicsSystemInterface] Failed to close window.");

View File

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

View File

@ -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.