Fix terrain physics error on end play when it's disabled

#3590 #3603
This commit is contained in:
Wojtek Figat
2025-10-03 22:30:44 +02:00
parent c61c013517
commit 8f3b80492e
2 changed files with 2 additions and 5 deletions

View File

@@ -2218,7 +2218,8 @@ void TerrainPatch::DestroyCollision()
void* scene = _terrain->GetPhysicsScene()->GetPhysicsScene();
PhysicsBackend::RemoveCollider(_terrain);
PhysicsBackend::RemoveSceneActor(scene, _physicsActor);
if (_terrain->IsDuringPlay() && _terrain->IsActiveInHierarchy())
PhysicsBackend::RemoveSceneActor(scene, _physicsActor);
PhysicsBackend::DestroyActor(_physicsActor);
PhysicsBackend::DestroyShape(_physicsShape);
PhysicsBackend::DestroyObject(_physicsHeightField);