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.cs79
1 files changed, 72 insertions, 7 deletions
diff --git a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
index 4f8ec7f..bac45eb 100644
--- a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
+++ b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
@@ -168,7 +168,10 @@ namespace OpenSim.Region.Physics.OdePlugin
168 168
169 } 169 }
170 170
171 171 public string whichspaceamIin(PhysicsVector pos)
172 {
173 return calculateSpaceForGeom(pos).ToString();
174 }
172 175
173 private void near(IntPtr space, IntPtr g1, IntPtr g2) 176 private void near(IntPtr space, IntPtr g1, IntPtr g2)
174 { 177 {
@@ -412,7 +415,13 @@ namespace OpenSim.Region.Physics.OdePlugin
412 if (!(((OdePrim)prim).m_targetSpace.Equals(null))) 415 if (!(((OdePrim)prim).m_targetSpace.Equals(null)))
413 { 416 {
414 if (d.GeomIsSpace(((OdePrim)prim).m_targetSpace)) 417 if (d.GeomIsSpace(((OdePrim)prim).m_targetSpace))
418 {
415 d.SpaceRemove(((OdePrim)prim).m_targetSpace, ((OdePrim)prim).prim_geom); 419 d.SpaceRemove(((OdePrim)prim).m_targetSpace, ((OdePrim)prim).prim_geom);
420 }
421 else
422 {
423 OpenSim.Framework.Console.MainLog.Instance.Verbose("Physics", "Invalid Scene passed to 'removeprim from scene':" + ((OdePrim)prim).m_targetSpace.ToString());
424 }
416 } 425 }
417 } 426 }
418 427
@@ -430,6 +439,10 @@ namespace OpenSim.Region.Physics.OdePlugin
430 d.SpaceDestroy(((OdePrim)prim).m_targetSpace); 439 d.SpaceDestroy(((OdePrim)prim).m_targetSpace);
431 resetSpaceArrayItemToZero(calculateSpaceArrayItemFromPos(((OdePrim)prim).Position)); 440 resetSpaceArrayItemToZero(calculateSpaceArrayItemFromPos(((OdePrim)prim).Position));
432 } 441 }
442 else
443 {
444 OpenSim.Framework.Console.MainLog.Instance.Verbose("Physics", "Invalid Scene passed to 'removeprim from scene':" + ((OdePrim)prim).m_targetSpace.ToString());
445 }
433 } 446 }
434 } 447 }
435 } 448 }
@@ -468,7 +481,14 @@ namespace OpenSim.Region.Physics.OdePlugin
468 if (d.SpaceQuery(currentspace, geom) && currentspace != (IntPtr)0) 481 if (d.SpaceQuery(currentspace, geom) && currentspace != (IntPtr)0)
469 { 482 {
470 if (d.GeomIsSpace(currentspace)) 483 if (d.GeomIsSpace(currentspace))
484 {
485
471 d.SpaceRemove(currentspace, geom); 486 d.SpaceRemove(currentspace, geom);
487 }
488 else
489 {
490 OpenSim.Framework.Console.MainLog.Instance.Verbose("Physics", "Invalid Scene passed to 'recalculatespace':" + currentspace.ToString() + " Geom:" + geom.ToString());
491 }
472 } 492 }
473 else 493 else
474 { 494 {
@@ -477,7 +497,13 @@ namespace OpenSim.Region.Physics.OdePlugin
477 { 497 {
478 if (sGeomIsIn != (IntPtr)0) 498 if (sGeomIsIn != (IntPtr)0)
479 if (d.GeomIsSpace(currentspace)) 499 if (d.GeomIsSpace(currentspace))
480 d.SpaceRemove(sGeomIsIn, geom); 500 {
501 d.SpaceRemove(sGeomIsIn, geom);
502 }
503 else
504 {
505 OpenSim.Framework.Console.MainLog.Instance.Verbose("Physics", "Invalid Scene passed to 'recalculatespace':" + sGeomIsIn.ToString() + " Geom:" + geom.ToString());
506 }
481 } 507 }
482 } 508 }
483 509
@@ -487,13 +513,18 @@ namespace OpenSim.Region.Physics.OdePlugin
487 { 513 {
488 if (currentspace != (IntPtr)0) 514 if (currentspace != (IntPtr)0)
489 { 515 {
490 if (d.GeomIsSpace(currentspace)) 516 if (d.GeomIsSpace(currentspace))
491 { 517 {
492 d.SpaceRemove(space, currentspace); 518 d.SpaceRemove(space, currentspace);
493 // free up memory used by the space. 519 // free up memory used by the space.
494 d.SpaceDestroy(currentspace); 520 d.SpaceDestroy(currentspace);
495 resetSpaceArrayItemToZero(currentspace); 521 resetSpaceArrayItemToZero(currentspace);
496 } 522 }
523 else
524 {
525 OpenSim.Framework.Console.MainLog.Instance.Verbose("Physics", "Invalid Scene passed to 'recalculatespace':" + currentspace.ToString() + " Geom:" + geom.ToString());
526 }
527
497 } 528 }
498 } 529 }
499 } 530 }
@@ -503,7 +534,15 @@ namespace OpenSim.Region.Physics.OdePlugin
503 if (d.SpaceQuery(currentspace, geom)) 534 if (d.SpaceQuery(currentspace, geom))
504 { 535 {
505 if (currentspace != (IntPtr)0) 536 if (currentspace != (IntPtr)0)
506 d.SpaceRemove(currentspace, geom); 537 if (d.GeomIsSpace(currentspace))
538 {
539 d.SpaceRemove(currentspace, geom);
540 }
541 else
542 {
543 OpenSim.Framework.Console.MainLog.Instance.Verbose("Physics", "Invalid Scene passed to 'recalculatespace':" + currentspace.ToString() + " Geom:" + geom.ToString());
544
545 }
507 } 546 }
508 else 547 else
509 { 548 {
@@ -512,8 +551,15 @@ namespace OpenSim.Region.Physics.OdePlugin
512 { 551 {
513 if (sGeomIsIn != (IntPtr)0) 552 if (sGeomIsIn != (IntPtr)0)
514 { 553 {
515 if (d.GeomIsSpace(sGeomIsIn)) 554 if (d.GeomIsSpace(sGeomIsIn))
516 d.SpaceRemove(sGeomIsIn, geom); 555 {
556 d.SpaceRemove(sGeomIsIn, geom);
557 }
558 else
559 {
560 OpenSim.Framework.Console.MainLog.Instance.Verbose("Physics", "Invalid Scene passed to 'recalculatespace':" + sGeomIsIn.ToString() + " Geom:" + geom.ToString());
561
562 }
517 } 563 }
518 } 564 }
519 } 565 }
@@ -1279,6 +1325,16 @@ namespace OpenSim.Region.Physics.OdePlugin
1279 { 1325 {
1280 m_lastUpdateSent = true; 1326 m_lastUpdateSent = true;
1281 base.RequestPhysicsterseUpdate(); 1327 base.RequestPhysicsterseUpdate();
1328 string primScenAvatarIn = _parent_scene.whichspaceamIin(_position);
1329 int arrayitem = _parent_scene.calculateSpaceArrayItemFromPos(_position);
1330 if (primScenAvatarIn == "0")
1331 {
1332 OpenSim.Framework.Console.MainLog.Instance.Verbose("Physics", "Avatar " + m_name + " in space with no prim. Arr:':" + arrayitem.ToString());
1333 }
1334 else
1335 {
1336 OpenSim.Framework.Console.MainLog.Instance.Verbose("Physics", "Avatar " + m_name + " in Prim space':" + primScenAvatarIn + ". Arr:" + arrayitem.ToString());
1337 }
1282 1338
1283 } 1339 }
1284 } 1340 }
@@ -1571,7 +1627,16 @@ namespace OpenSim.Region.Physics.OdePlugin
1571 } 1627 }
1572 else 1628 else
1573 { 1629 {
1574 1630 string primScenAvatarIn = _parent_scene.whichspaceamIin(_position);
1631 int arrayitem = _parent_scene.calculateSpaceArrayItemFromPos(_position);
1632 if (primScenAvatarIn == "0")
1633 {
1634 OpenSim.Framework.Console.MainLog.Instance.Verbose("Physics", "Prim " + m_primName + " in space with no prim: " + primScenAvatarIn + ". Expected to be at: " + m_targetSpace.ToString() + " . Arr:': " + arrayitem.ToString());
1635 }
1636 else
1637 {
1638 OpenSim.Framework.Console.MainLog.Instance.Verbose("Physics", "Prim " + m_primName + " in Prim space with prim: " + primScenAvatarIn + ". Expected to be at: " + m_targetSpace.ToString() + ". Arr:" + arrayitem.ToString());
1639 }
1575 m_targetSpace = _parent_scene.recalculateSpaceForGeom(prim_geom, _position, m_targetSpace); 1640 m_targetSpace = _parent_scene.recalculateSpaceForGeom(prim_geom, _position, m_targetSpace);
1576 d.GeomSetPosition(prim_geom, _position.X, _position.Y, _position.Z); 1641 d.GeomSetPosition(prim_geom, _position.X, _position.Y, _position.Z);
1577 d.SpaceAdd(m_targetSpace, prim_geom); 1642 d.SpaceAdd(m_targetSpace, prim_geom);