diff options
Diffstat (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSScene.cs')
-rw-r--r-- | OpenSim/Region/Physics/BulletSPlugin/BSScene.cs | 29 |
1 files changed, 24 insertions, 5 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs index 28d5cb5..011033c 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs | |||
@@ -390,9 +390,9 @@ public class BSScene : PhysicsScene, IPhysicsParameters | |||
390 | // Simulate one timestep | 390 | // Simulate one timestep |
391 | public override float Simulate(float timeStep) | 391 | public override float Simulate(float timeStep) |
392 | { | 392 | { |
393 | int updatedEntityCount; | 393 | int updatedEntityCount = 0; |
394 | IntPtr updatedEntitiesPtr; | 394 | IntPtr updatedEntitiesPtr; |
395 | int collidersCount; | 395 | int collidersCount = 0; |
396 | IntPtr collidersPtr; | 396 | IntPtr collidersPtr; |
397 | 397 | ||
398 | LastSimulatedTimestep = timeStep; | 398 | LastSimulatedTimestep = timeStep; |
@@ -411,8 +411,21 @@ public class BSScene : PhysicsScene, IPhysicsParameters | |||
411 | 411 | ||
412 | // step the physical world one interval | 412 | // step the physical world one interval |
413 | m_simulationStep++; | 413 | m_simulationStep++; |
414 | int numSubSteps = BulletSimAPI.PhysicsStep(m_worldID, timeStep, m_maxSubSteps, m_fixedTimeStep, | 414 | int numSubSteps = 0; |
415 | out updatedEntityCount, out updatedEntitiesPtr, out collidersCount, out collidersPtr); | 415 | try |
416 | { | ||
417 | numSubSteps = BulletSimAPI.PhysicsStep(m_worldID, timeStep, m_maxSubSteps, m_fixedTimeStep, | ||
418 | out updatedEntityCount, out updatedEntitiesPtr, out collidersCount, out collidersPtr); | ||
419 | DetailLog("{0},Simulate,call, substeps={1}, updates={2}, colliders={3}", "0000000000", numSubSteps, updatedEntityCount, collidersCount); | ||
420 | } | ||
421 | catch (Exception e) | ||
422 | { | ||
423 | m_log.WarnFormat("{0},PhysicsStep Exception: substeps={1}, updates={2}, colliders={3}, e={4}", LogHeader, numSubSteps, updatedEntityCount, collidersCount, e); | ||
424 | DetailLog("{0},PhysicsStepException,call, substeps={1}, updates={2}, colliders={3}", "0000000000", numSubSteps, updatedEntityCount, collidersCount); | ||
425 | // updatedEntityCount = 0; | ||
426 | collidersCount = 0; | ||
427 | } | ||
428 | |||
416 | 429 | ||
417 | // Don't have to use the pointers passed back since we know it is the same pinned memory we passed in | 430 | // Don't have to use the pointers passed back since we know it is the same pinned memory we passed in |
418 | 431 | ||
@@ -711,7 +724,7 @@ public class BSScene : PhysicsScene, IPhysicsParameters | |||
711 | return true; | 724 | return true; |
712 | } | 725 | } |
713 | 726 | ||
714 | // The calls to the PhysicsActors can't directly call into the physics engine | 727 | // Calls to the PhysicsActors can't directly call into the physics engine |
715 | // because it might be busy. We delay changes to a known time. | 728 | // because it might be busy. We delay changes to a known time. |
716 | // We rely on C#'s closure to save and restore the context for the delegate. | 729 | // We rely on C#'s closure to save and restore the context for the delegate. |
717 | public void TaintedObject(TaintCallback callback) | 730 | public void TaintedObject(TaintCallback callback) |
@@ -1275,5 +1288,11 @@ public class BSScene : PhysicsScene, IPhysicsParameters | |||
1275 | 1288 | ||
1276 | #endregion Runtime settable parameters | 1289 | #endregion Runtime settable parameters |
1277 | 1290 | ||
1291 | // Invoke the detailed logger and output something if it's enabled. | ||
1292 | private void DetailLog(string msg, params Object[] args) | ||
1293 | { | ||
1294 | PhysicsLogging.Write(msg, args); | ||
1295 | } | ||
1296 | |||
1278 | } | 1297 | } |
1279 | } | 1298 | } |