Fix physics error when disabling terrain

This commit is contained in:
Wojtek Figat
2024-07-19 00:30:21 +02:00
parent 53ca33f301
commit 9518ce1d0a

View File

@@ -831,6 +831,15 @@ void Terrain::OnDisable()
#if TERRAIN_USE_PHYSICS_DEBUG
GetSceneRendering()->RemovePhysicsDebug<Terrain, &Terrain::DrawPhysicsDebug>(this);
#endif
void* scene = GetPhysicsScene()->GetPhysicsScene();
for (int32 i = 0; i < _patches.Count(); i++)
{
auto patch = _patches[i];
if (patch->_physicsActor)
{
PhysicsBackend::RemoveSceneActor(scene, patch->_physicsActor);
}
}
// Base
Actor::OnDisable();