aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Physics/OdePlugin/OdePlugin.cs')
-rw-r--r--OpenSim/Region/Physics/OdePlugin/OdePlugin.cs94
1 files changed, 52 insertions, 42 deletions
diff --git a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
index 0fd4f4d..c4d249d 100644
--- a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
+++ b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
@@ -269,6 +269,8 @@ namespace OpenSim.Region.Physics.OdePlugin
269 269
270 if (d.GeomIsSpace(g1) || d.GeomIsSpace(g2)) 270 if (d.GeomIsSpace(g1) || d.GeomIsSpace(g2))
271 { 271 {
272 if (g1 == (IntPtr)0 || g2 == (IntPtr)0)
273 return;
272 // Separating static prim geometry spaces. 274 // Separating static prim geometry spaces.
273 // We'll be calling near recursivly if one 275 // We'll be calling near recursivly if one
274 // of them is a space to find all of the 276 // of them is a space to find all of the
@@ -280,6 +282,7 @@ namespace OpenSim.Region.Physics.OdePlugin
280 catch (System.AccessViolationException) 282 catch (System.AccessViolationException)
281 { 283 {
282 m_log.Warn("[PHYSICS]: Unable to collide test a space"); 284 m_log.Warn("[PHYSICS]: Unable to collide test a space");
285 return;
283 } 286 }
284 //Colliding a space or a geom with a space or a geom. so drill down 287 //Colliding a space or a geom with a space or a geom. so drill down
285 288
@@ -291,6 +294,8 @@ namespace OpenSim.Region.Physics.OdePlugin
291 { 294 {
292 // Colliding Geom To Geom 295 // Colliding Geom To Geom
293 // This portion of the function 'was' blatantly ripped off from BoxStack.cs 296 // This portion of the function 'was' blatantly ripped off from BoxStack.cs
297 if (g1 == (IntPtr)0 || g2 == (IntPtr)0)
298 return;
294 299
295 IntPtr b1 = d.GeomGetBody(g1); 300 IntPtr b1 = d.GeomGetBody(g1);
296 IntPtr b2 = d.GeomGetBody(g2); 301 IntPtr b2 = d.GeomGetBody(g2);
@@ -301,6 +306,8 @@ namespace OpenSim.Region.Physics.OdePlugin
301 if (b1 != IntPtr.Zero && b2 != IntPtr.Zero && d.AreConnectedExcluding(b1, b2, d.JointType.Contact)) 306 if (b1 != IntPtr.Zero && b2 != IntPtr.Zero && d.AreConnectedExcluding(b1, b2, d.JointType.Contact))
302 return; 307 return;
303 308
309
310
304 d.GeomClassID id = d.GeomGetClass(g1); 311 d.GeomClassID id = d.GeomGetClass(g1);
305 312
306 String name1 = null; 313 String name1 = null;
@@ -325,6 +332,7 @@ namespace OpenSim.Region.Physics.OdePlugin
325 int count = 0; 332 int count = 0;
326 try 333 try
327 { 334 {
335 //m_log.Warn(g1.ToString() + "|" + g2.ToString());
328 count = d.Collide(g1, g2, contacts.GetLength(0), contacts, d.ContactGeom.SizeOf); 336 count = d.Collide(g1, g2, contacts.GetLength(0), contacts, d.ContactGeom.SizeOf);
329 } 337 }
330 catch (SEHException) 338 catch (SEHException)
@@ -335,7 +343,9 @@ namespace OpenSim.Region.Physics.OdePlugin
335 } 343 }
336 catch (System.AccessViolationException) 344 catch (System.AccessViolationException)
337 { 345 {
346
338 m_log.Warn("[PHYSICS]: Unable to collide test an object"); 347 m_log.Warn("[PHYSICS]: Unable to collide test an object");
348 return;
339 } 349 }
340 350
341 PhysicsActor p1; 351 PhysicsActor p1;
@@ -438,48 +448,48 @@ namespace OpenSim.Region.Physics.OdePlugin
438 // If you interpenetrate a prim with another prim 448 // If you interpenetrate a prim with another prim
439 if (p1.PhysicsActorType == (int) ActorTypes.Prim && p2.PhysicsActorType == (int) ActorTypes.Prim) 449 if (p1.PhysicsActorType == (int) ActorTypes.Prim && p2.PhysicsActorType == (int) ActorTypes.Prim)
440 { 450 {
441 OdePrim op1 = (OdePrim)p1; 451 //OdePrim op1 = (OdePrim)p1;
442 OdePrim op2 = (OdePrim)p2; 452 //OdePrim op2 = (OdePrim)p2;
443 op1.m_collisionscore++; 453 //op1.m_collisionscore++;
444 op2.m_collisionscore++; 454 //op2.m_collisionscore++;
445 455
446 456
447 if (op1.m_collisionscore > 80 || op2.m_collisionscore > 80) 457 //if (op1.m_collisionscore > 8000 || op2.m_collisionscore > 8000)
448 { 458 //{
449 op1.m_taintdisable = true; 459 //op1.m_taintdisable = true;
450 AddPhysicsActorTaint(p1); 460 //AddPhysicsActorTaint(p1);
451 op2.m_taintdisable = true; 461 //op2.m_taintdisable = true;
452 AddPhysicsActorTaint(p2); 462 //AddPhysicsActorTaint(p2);
453 } 463 //}
454 464
455 if (contacts[i].depth >= 0.25f) 465 //if (contacts[i].depth >= 0.25f)
456 { 466 //{
457 // Don't collide, one or both prim will expld. 467 // Don't collide, one or both prim will expld.
458 468
459 469
460 op1.m_interpenetrationcount++; 470 //op1.m_interpenetrationcount++;
461 op2.m_interpenetrationcount++; 471 //op2.m_interpenetrationcount++;
462 interpenetrations_before_disable = 20; 472 //interpenetrations_before_disable = 200;
463 if (op1.m_interpenetrationcount >= interpenetrations_before_disable) 473 //if (op1.m_interpenetrationcount >= interpenetrations_before_disable)
464 { 474 //{
465 op1.m_taintdisable = true; 475 //op1.m_taintdisable = true;
466 AddPhysicsActorTaint(p1); 476 //AddPhysicsActorTaint(p1);
467 } 477 //}
468 if (op2.m_interpenetrationcount >= interpenetrations_before_disable) 478 //if (op2.m_interpenetrationcount >= interpenetrations_before_disable)
469 { 479 //{
470 op2.m_taintdisable = true; 480 // op2.m_taintdisable = true;
471 AddPhysicsActorTaint(p2); 481 //AddPhysicsActorTaint(p2);
472 } 482 //}
473 483
474 484
475 //contacts[i].depth = contacts[i].depth / 8f; 485 //contacts[i].depth = contacts[i].depth / 8f;
476 //contacts[i].normal = new d.Vector3(0, 0, 1); 486 //contacts[i].normal = new d.Vector3(0, 0, 1);
477 } 487 //}
478 if (op1.m_disabled || op2.m_disabled) 488 //if (op1.m_disabled || op2.m_disabled)
479 { 489 //{
480 //Manually disabled objects stay disabled 490 //Manually disabled objects stay disabled
481 contacts[i].depth = 0f; 491 //contacts[i].depth = 0f;
482 } 492 //}
483 } 493 }
484 if (contacts[i].depth >= 1.00f) 494 if (contacts[i].depth >= 1.00f)
485 { 495 {
@@ -720,9 +730,9 @@ namespace OpenSim.Region.Physics.OdePlugin
720 { 730 {
721 OdePrim p = (OdePrim) prim; 731 OdePrim p = (OdePrim) prim;
722 732
723 //p.setPrimForRemoval(); 733 p.setPrimForRemoval();
724 //AddPhysicsActorTaint(prim); 734 AddPhysicsActorTaint(prim);
725 RemovePrimThreadLocked(p); 735 //RemovePrimThreadLocked(p);
726 } 736 }
727 } 737 }
728 } 738 }
@@ -760,8 +770,8 @@ namespace OpenSim.Region.Physics.OdePlugin
760 //m_log.Warn(prim.m_targetSpace); 770 //m_log.Warn(prim.m_targetSpace);
761 771
762 772
763 if (prim.m_targetSpace != (IntPtr)0) 773 //if (prim.m_targetSpace != (IntPtr)0)
764 { 774 //{
765 if (d.SpaceQuery(prim.m_targetSpace, prim.prim_geom)) 775 if (d.SpaceQuery(prim.m_targetSpace, prim.prim_geom))
766 { 776 {
767 777
@@ -769,7 +779,7 @@ namespace OpenSim.Region.Physics.OdePlugin
769 { 779 {
770 waitForSpaceUnlock(prim.m_targetSpace); 780 waitForSpaceUnlock(prim.m_targetSpace);
771 d.SpaceRemove(prim.m_targetSpace, prim.prim_geom); 781 d.SpaceRemove(prim.m_targetSpace, prim.prim_geom);
772 prim.m_targetSpace = space; 782 prim.m_targetSpace = (IntPtr) 0;
773 } 783 }
774 else 784 else
775 { 785 {
@@ -778,7 +788,7 @@ namespace OpenSim.Region.Physics.OdePlugin
778 } 788 }
779 789
780 } 790 }
781 } 791 //}
782 //m_log.Warn(prim.prim_geom); 792 //m_log.Warn(prim.prim_geom);
783 try 793 try
784 { 794 {
@@ -1309,10 +1319,10 @@ namespace OpenSim.Region.Physics.OdePlugin
1309 bool processedtaints = false; 1319 bool processedtaints = false;
1310 foreach (OdePrim prim in _taintedPrim) 1320 foreach (OdePrim prim in _taintedPrim)
1311 { 1321 {
1312 //if (prim.m_taintremove) 1322 if (prim.m_taintremove)
1313 //{ 1323 {
1314 //RemovePrimThreadLocked(prim); 1324 RemovePrimThreadLocked(prim);
1315 //} 1325 }
1316 1326
1317 prim.ProcessTaints(timeStep); 1327 prim.ProcessTaints(timeStep);
1318 1328