BulletSim: fix problem of a null reference exception on shutdown if there were linksets in the region.
parent
77a7758cf5
commit
257446889b
|
@ -511,12 +511,12 @@ public class BSScene : PhysicsScene, IPhysicsParameters
|
||||||
// long simulateTotalTime = Util.EnvironmentTickCountSubtract(simulateStartTime);
|
// long simulateTotalTime = Util.EnvironmentTickCountSubtract(simulateStartTime);
|
||||||
// return (timeStep * (float)simulateTotalTime);
|
// return (timeStep * (float)simulateTotalTime);
|
||||||
|
|
||||||
// TODO: FIX THIS: fps calculation possibly wrong.
|
// TODO: FIX THIS: fps calculation possibly wrong.
|
||||||
// This calculation says 1/timeStep is the ideal frame rate. Any time added to
|
// This calculation says 1/timeStep is the ideal frame rate. Any time added to
|
||||||
// that by the physics simulation gives a slower frame rate.
|
// that by the physics simulation gives a slower frame rate.
|
||||||
long totalSimulationTime = Util.EnvironmentTickCountSubtract(simulateStartTime);
|
long totalSimulationTime = Util.EnvironmentTickCountSubtract(simulateStartTime);
|
||||||
if (totalSimulationTime >= timeStep)
|
if (totalSimulationTime >= timeStep)
|
||||||
return 0;
|
return 0;
|
||||||
return 1f / (timeStep + totalSimulationTime);
|
return 1f / (timeStep + totalSimulationTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -595,12 +595,6 @@ public class BSScene : PhysicsScene, IPhysicsParameters
|
||||||
// make sure no stepping happens while we're deleting stuff
|
// make sure no stepping happens while we're deleting stuff
|
||||||
m_initialized = false;
|
m_initialized = false;
|
||||||
|
|
||||||
if (m_constraintCollection != null)
|
|
||||||
{
|
|
||||||
m_constraintCollection.Dispose();
|
|
||||||
m_constraintCollection = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach (KeyValuePair<uint, BSCharacter> kvp in m_avatars)
|
foreach (KeyValuePair<uint, BSCharacter> kvp in m_avatars)
|
||||||
{
|
{
|
||||||
kvp.Value.Destroy();
|
kvp.Value.Destroy();
|
||||||
|
@ -613,6 +607,13 @@ public class BSScene : PhysicsScene, IPhysicsParameters
|
||||||
}
|
}
|
||||||
m_prims.Clear();
|
m_prims.Clear();
|
||||||
|
|
||||||
|
// Now that the prims are all cleaned up, there should be no constraints left
|
||||||
|
if (m_constraintCollection != null)
|
||||||
|
{
|
||||||
|
m_constraintCollection.Dispose();
|
||||||
|
m_constraintCollection = null;
|
||||||
|
}
|
||||||
|
|
||||||
// Anything left in the unmanaged code should be cleaned out
|
// Anything left in the unmanaged code should be cleaned out
|
||||||
BulletSimAPI.Shutdown(WorldID);
|
BulletSimAPI.Shutdown(WorldID);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue