Fixed bug where changing scene while editor is active would not build the world before the first update #262
|
@ -44,8 +44,6 @@ namespace Sandbox
|
||||||
{
|
{
|
||||||
sceneName = SHSerialization::DeserializeSceneFromFile(sceneAssetID);
|
sceneName = SHSerialization::DeserializeSceneFromFile(sceneAssetID);
|
||||||
|
|
||||||
#ifndef SHEDITOR
|
|
||||||
|
|
||||||
auto* physicsSystem = SHSystemManager::GetSystem<SHPhysicsSystem>();
|
auto* physicsSystem = SHSystemManager::GetSystem<SHPhysicsSystem>();
|
||||||
if (!physicsSystem)
|
if (!physicsSystem)
|
||||||
{
|
{
|
||||||
|
@ -53,6 +51,12 @@ namespace Sandbox
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef SHEDITOR
|
||||||
|
|
||||||
|
physicsSystem->ForceBuild(SHSceneManager::GetCurrentSceneGraph());
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
physicsSystem->BuildScene(SHSceneManager::GetCurrentSceneGraph());
|
physicsSystem->BuildScene(SHSceneManager::GetCurrentSceneGraph());
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -188,6 +188,13 @@ namespace SHADE
|
||||||
objectManager.UpdateCommands();
|
objectManager.UpdateCommands();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SHPhysicsSystem::ForceBuild(SHSceneGraph& sceneGraph)
|
||||||
|
{
|
||||||
|
// HACK: Band-aid fix. To be removed.
|
||||||
|
objectManager.UpdateCommands();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void SHPhysicsSystem::ForceUpdate()
|
void SHPhysicsSystem::ForceUpdate()
|
||||||
{
|
{
|
||||||
if (!worldState.world)
|
if (!worldState.world)
|
||||||
|
@ -419,7 +426,6 @@ namespace SHADE
|
||||||
for (size_t i = 0; i < COLLIDER->GetCollisionShapes().size(); ++i)
|
for (size_t i = 0; i < COLLIDER->GetCollisionShapes().size(); ++i)
|
||||||
objectManager.AddCollisionShape(EID, i);
|
objectManager.AddCollisionShape(EID, i);
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
////////////////////////////////
|
////////////////////////////////
|
||||||
|
|
|
@ -78,9 +78,9 @@ namespace SHADE
|
||||||
void Exit () override;
|
void Exit () override;
|
||||||
|
|
||||||
void BuildScene (SHSceneGraph& sceneGraph);
|
void BuildScene (SHSceneGraph& sceneGraph);
|
||||||
|
void ForceBuild (SHSceneGraph& sceneGraph);
|
||||||
void ForceUpdate ();
|
void ForceUpdate ();
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Casts a ray into the world.
|
* @brief Casts a ray into the world.
|
||||||
* @param ray The ray to cast.
|
* @param ray The ray to cast.
|
||||||
|
|
Loading…
Reference in New Issue