aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Physics')
-rw-r--r--OpenSim/Region/Physics/OdePlugin/OdePlugin.cs36
1 files changed, 23 insertions, 13 deletions
diff --git a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
index 6692d97..ee5e777 100644
--- a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
+++ b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
@@ -179,7 +179,7 @@ namespace OpenSim.Region.Physics.OdePlugin
179 // We'll be calling near recursivly if one 179 // We'll be calling near recursivly if one
180 // of them is a space to find all of the 180 // of them is a space to find all of the
181 // contact points in the space 181 // contact points in the space
182 182
183 d.SpaceCollide2(g1, g2, IntPtr.Zero, nearCallback); 183 d.SpaceCollide2(g1, g2, IntPtr.Zero, nearCallback);
184 //Colliding a space or a geom with a space or a geom. 184 //Colliding a space or a geom with a space or a geom.
185 185
@@ -199,8 +199,6 @@ namespace OpenSim.Region.Physics.OdePlugin
199 199
200 if (g1 == g2) 200 if (g1 == g2)
201 return; // Can't collide with yourself 201 return; // Can't collide with yourself
202
203
204 202
205 if (b1 != IntPtr.Zero && b2 != IntPtr.Zero && d.AreConnectedExcluding(b1, b2, d.JointType.Contact)) 203 if (b1 != IntPtr.Zero && b2 != IntPtr.Zero && d.AreConnectedExcluding(b1, b2, d.JointType.Contact))
206 return; 204 return;
@@ -457,7 +455,7 @@ namespace OpenSim.Region.Physics.OdePlugin
457 // never be called if the prim is physical(active) 455 // never be called if the prim is physical(active)
458 if (currentspace != space) 456 if (currentspace != space)
459 { 457 {
460 if (d.SpaceQuery(currentspace, geom)) 458 if (d.SpaceQuery(currentspace, geom) && currentspace != (IntPtr)0)
461 { 459 {
462 460
463 d.SpaceRemove(currentspace, geom); 461 d.SpaceRemove(currentspace, geom);
@@ -466,17 +464,23 @@ namespace OpenSim.Region.Physics.OdePlugin
466 { 464 {
467 IntPtr sGeomIsIn = d.GeomGetSpace(geom); 465 IntPtr sGeomIsIn = d.GeomGetSpace(geom);
468 if (!(sGeomIsIn.Equals(null))) 466 if (!(sGeomIsIn.Equals(null)))
469 d.SpaceRemove(sGeomIsIn, geom); 467 {
468 if (sGeomIsIn != (IntPtr)0)
469 d.SpaceRemove(sGeomIsIn, geom);
470 }
470 } 471 }
471 472
472 473
473 //If there are no more geometries in the sub-space, we don't need it in the main space anymore 474 //If there are no more geometries in the sub-space, we don't need it in the main space anymore
474 if (d.SpaceGetNumGeoms(currentspace) == 0) 475 if (d.SpaceGetNumGeoms(currentspace) == 0)
475 { 476 {
476 d.SpaceRemove(space, currentspace); 477 if (currentspace != (IntPtr)0)
477 // free up memory used by the space. 478 {
478 d.SpaceDestroy(currentspace); 479 d.SpaceRemove(space, currentspace);
479 resetSpaceArrayItemToZero(currentspace); 480 // free up memory used by the space.
481 d.SpaceDestroy(currentspace);
482 resetSpaceArrayItemToZero(currentspace);
483 }
480 } 484 }
481 } 485 }
482 else 486 else
@@ -484,14 +488,19 @@ namespace OpenSim.Region.Physics.OdePlugin
484 // this is a physical object that got disabled. ;.; 488 // this is a physical object that got disabled. ;.;
485 if (d.SpaceQuery(currentspace, geom)) 489 if (d.SpaceQuery(currentspace, geom))
486 { 490 {
487 491 if (currentspace != (IntPtr)0)
488 d.SpaceRemove(currentspace, geom); 492 d.SpaceRemove(currentspace, geom);
489 } 493 }
490 else 494 else
491 { 495 {
492 IntPtr sGeomIsIn = d.GeomGetSpace(geom); 496 IntPtr sGeomIsIn = d.GeomGetSpace(geom);
493 if (!(sGeomIsIn.Equals(null))) 497 if (!(sGeomIsIn.Equals(null)))
494 d.SpaceRemove(sGeomIsIn, geom); 498 {
499 if (sGeomIsIn != (IntPtr)0)
500 {
501 d.SpaceRemove(sGeomIsIn, geom);
502 }
503 }
495 } 504 }
496 } 505 }
497 506
@@ -1547,8 +1556,9 @@ namespace OpenSim.Region.Physics.OdePlugin
1547 } 1556 }
1548 else 1557 else
1549 { 1558 {
1550 d.GeomSetPosition(prim_geom, _position.X, _position.Y, _position.Z); 1559
1551 m_targetSpace = _parent_scene.recalculateSpaceForGeom(prim_geom, _position, m_targetSpace); 1560 m_targetSpace = _parent_scene.recalculateSpaceForGeom(prim_geom, _position, m_targetSpace);
1561 d.GeomSetPosition(prim_geom, _position.X, _position.Y, _position.Z);
1552 d.SpaceAdd(m_targetSpace, prim_geom); 1562 d.SpaceAdd(m_targetSpace, prim_geom);
1553 } 1563 }
1554 1564