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

@@ -67,7 +67,7 @@ public abstract class BSTerrainPhys : IDisposable
}
// ==========================================================================================
public sealed class BSTerrainManager
public sealed class BSTerrainManager : IDisposable
{
static string LogHeader = "[BULLETSIM TERRAIN MANAGER]";
@@ -122,6 +122,11 @@ public sealed class BSTerrainManager
MegaRegionParentPhysicsScene = null;
}
public void Dispose()
{
ReleaseGroundPlaneAndTerrain();
}
// Create the initial instance of terrain and the underlying ground plane.
// This is called from the initialization routine so we presume it is
// safe to call Bullet in real time. We hope no one is moving prims around yet.
@@ -366,6 +371,9 @@ public sealed class BSTerrainManager
{
PhysicsScene.Logger.ErrorFormat("{0} GetTerrainHeightAtXY: terrain not found: region={1}, x={2}, y={3}",
LogHeader, PhysicsScene.RegionName, tX, tY);
DetailLog("{0},BSTerrainManager.GetTerrainHeightAtXYZ,terrainNotFound,loc={1},base={2}",
BSScene.DetailLogZero, loc, terrainBaseXYZ);
Util.PrintCallStack(); // DEBUG DEBUG DEBUG
}
}
lastHeight = ret;