aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
diff options
context:
space:
mode:
authorDr Scofield2009-06-25 07:39:48 +0000
committerDr Scofield2009-06-25 07:39:48 +0000
commit652bcf91d50898181638a2668c9e2dcacfa33005 (patch)
treec1bdb97e6ef633d9b7605acbaa7eab6afd404f48 /OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
parentAllow "Take Copy" with copy only permissions if you own the object. Trans (diff)
downloadopensim-SC_OLD-652bcf91d50898181638a2668c9e2dcacfa33005.zip
opensim-SC_OLD-652bcf91d50898181638a2668c9e2dcacfa33005.tar.gz
opensim-SC_OLD-652bcf91d50898181638a2668c9e2dcacfa33005.tar.bz2
opensim-SC_OLD-652bcf91d50898181638a2668c9e2dcacfa33005.tar.xz
- fixes a "collection out of sync" exception in the ODE physics
engine, caused by an "avatar infinite position" occurring under heavy load. - fixes "value too small" exception in ChatModule
Diffstat (limited to 'OpenSim/Region/Physics/OdePlugin/OdePlugin.cs')
-rw-r--r--OpenSim/Region/Physics/OdePlugin/OdePlugin.cs77
1 files changed, 44 insertions, 33 deletions
diff --git a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
index 46689eb..0f92358 100644
--- a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
+++ b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
@@ -1434,42 +1434,45 @@ namespace OpenSim.Region.Physics.OdePlugin
1434 { 1434 {
1435 _perloopContact.Clear(); 1435 _perloopContact.Clear();
1436 1436
1437 foreach (OdeCharacter chr in _characters) 1437 lock (_characters)
1438 { 1438 {
1439 // Reset the collision values to false 1439 foreach (OdeCharacter chr in _characters)
1440 // since we don't know if we're colliding yet
1441
1442 // For some reason this can happen. Don't ask...
1443 //
1444 if (chr == null)
1445 continue;
1446
1447 if (chr.Shell == IntPtr.Zero || chr.Body == IntPtr.Zero)
1448 continue;
1449
1450 chr.IsColliding = false;
1451 chr.CollidingGround = false;
1452 chr.CollidingObj = false;
1453
1454 // test the avatar's geometry for collision with the space
1455 // This will return near and the space that they are the closest to
1456 // And we'll run this again against the avatar and the space segment
1457 // This will return with a bunch of possible objects in the space segment
1458 // and we'll run it again on all of them.
1459 try
1460 {
1461 d.SpaceCollide2(space, chr.Shell, IntPtr.Zero, nearCallback);
1462 }
1463 catch (AccessViolationException)
1464 { 1440 {
1465 m_log.Warn("[PHYSICS]: Unable to space collide"); 1441 // Reset the collision values to false
1466 } 1442 // since we don't know if we're colliding yet
1467 //float terrainheight = GetTerrainHeightAtXY(chr.Position.X, chr.Position.Y); 1443
1468 //if (chr.Position.Z + (chr.Velocity.Z * timeStep) < terrainheight + 10) 1444 // For some reason this can happen. Don't ask...
1469 //{ 1445 //
1446 if (chr == null)
1447 continue;
1448
1449 if (chr.Shell == IntPtr.Zero || chr.Body == IntPtr.Zero)
1450 continue;
1451
1452 chr.IsColliding = false;
1453 chr.CollidingGround = false;
1454 chr.CollidingObj = false;
1455
1456 // test the avatar's geometry for collision with the space
1457 // This will return near and the space that they are the closest to
1458 // And we'll run this again against the avatar and the space segment
1459 // This will return with a bunch of possible objects in the space segment
1460 // and we'll run it again on all of them.
1461 try
1462 {
1463 d.SpaceCollide2(space, chr.Shell, IntPtr.Zero, nearCallback);
1464 }
1465 catch (AccessViolationException)
1466 {
1467 m_log.Warn("[PHYSICS]: Unable to space collide");
1468 }
1469 //float terrainheight = GetTerrainHeightAtXY(chr.Position.X, chr.Position.Y);
1470 //if (chr.Position.Z + (chr.Velocity.Z * timeStep) < terrainheight + 10)
1471 //{
1470 //chr.Position.Z = terrainheight + 10.0f; 1472 //chr.Position.Z = terrainheight + 10.0f;
1471 //forcedZ = true; 1473 //forcedZ = true;
1472 //} 1474 //}
1475 }
1473 } 1476 }
1474 1477
1475 lock (_activeprims) 1478 lock (_activeprims)
@@ -2799,10 +2802,18 @@ namespace OpenSim.Region.Physics.OdePlugin
2799 // Move characters 2802 // Move characters
2800 lock (_characters) 2803 lock (_characters)
2801 { 2804 {
2805 List<OdeCharacter> defects = new List<OdeCharacter>();
2802 foreach (OdeCharacter actor in _characters) 2806 foreach (OdeCharacter actor in _characters)
2803 { 2807 {
2804 if (actor != null) 2808 if (actor != null)
2805 actor.Move(timeStep); 2809 actor.Move(timeStep, defects);
2810 }
2811 if (0 != defects.Count)
2812 {
2813 foreach (OdeCharacter defect in defects)
2814 {
2815 RemoveCharacter(defect);
2816 }
2806 } 2817 }
2807 } 2818 }
2808 2819