BulletSim: remove some errors on shutdown by moving terrain destruction until after physical object destruction. TerrainManager also made disposable and that feature used.

This commit is contained in:
Robert Adams
2012-12-15 11:31:26 -08:00
parent ace1f1e931
commit f3b1efd889
2 changed files with 16 additions and 3 deletions

View File

@@ -349,8 +349,6 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters
// make sure no stepping happens while we're deleting stuff
m_initialized = false;
TerrainManager.ReleaseGroundPlaneAndTerrain();
foreach (KeyValuePair<uint, BSPhysObject> kvp in PhysObjects)
{
kvp.Value.Destroy();
@@ -370,6 +368,13 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters
Shapes = null;
}
if (TerrainManager != null)
{
TerrainManager.ReleaseGroundPlaneAndTerrain();
TerrainManager.Dispose();
TerrainManager = null;
}
// Anything left in the unmanaged code should be cleaned out
BulletSimAPI.Shutdown2(World.ptr);