Add Physics::DeleteScene

This commit is contained in:
2026-06-03 05:03:32 +02:00
parent c2ec3fe2cb
commit f4be035f04
2 changed files with 14 additions and 0 deletions
+9
View File
@@ -184,6 +184,15 @@ PhysicsScene* Physics::FindScene(const StringView& name)
return nullptr;
}
void Physics::DeleteScene(PhysicsScene* scene)
{
if (scene == nullptr || scene == DefaultScene)
return;
scene->CollectResults();
Scenes.RemoveKeepOrder(scene);
Delete(scene);
}
bool Physics::GetAutoSimulation()
{
return !DefaultScene || DefaultScene->GetAutoSimulation();
+5
View File
@@ -32,6 +32,11 @@ API_CLASS(Static) class FLAXENGINE_API Physics
/// </summary>
API_FUNCTION() static PhysicsScene* FindScene(const StringView& name);
/// <summary>
/// Delete an existing scene (excluding the default one).
/// </summary>
API_FUNCTION() static void DeleteScene(PhysicsScene* scene);
public:
/// <summary>
/// The automatic simulation feature. True if perform physics simulation after on fixed update by auto, otherwise user should do it.