aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs')
-rw-r--r--OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs42
1 files changed, 30 insertions, 12 deletions
diff --git a/OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs b/OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs
index 8d87c30..6c5b405 100644
--- a/OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs
+++ b/OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs
@@ -228,8 +228,8 @@ namespace OpenSim.Region.PhysicsModule.ubOde
228 228
229 private d.NearCallback nearCallback; 229 private d.NearCallback nearCallback;
230 230
231 private Dictionary<uint,OdePrim> _prims = new Dictionary<uint,OdePrim>();
231 private HashSet<OdeCharacter> _characters = new HashSet<OdeCharacter>(); 232 private HashSet<OdeCharacter> _characters = new HashSet<OdeCharacter>();
232 private HashSet<OdePrim> _prims = new HashSet<OdePrim>();
233 private HashSet<OdePrim> _activeprims = new HashSet<OdePrim>(); 233 private HashSet<OdePrim> _activeprims = new HashSet<OdePrim>();
234 private HashSet<OdePrim> _activegroups = new HashSet<OdePrim>(); 234 private HashSet<OdePrim> _activegroups = new HashSet<OdePrim>();
235 235
@@ -1329,7 +1329,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
1329 1329
1330 newPrim = new OdePrim(name, this, position, size, rotation, pbs, isphysical, isPhantom, shapeType, localID); 1330 newPrim = new OdePrim(name, this, position, size, rotation, pbs, isphysical, isPhantom, shapeType, localID);
1331 lock (_prims) 1331 lock (_prims)
1332 _prims.Add(newPrim); 1332 _prims[newPrim.LocalID] = newPrim;
1333 } 1333 }
1334 return newPrim; 1334 return newPrim;
1335 } 1335 }
@@ -1391,15 +1391,26 @@ namespace OpenSim.Region.PhysicsModule.ubOde
1391 { 1391 {
1392// RemoveCollisionEventReporting(prim); 1392// RemoveCollisionEventReporting(prim);
1393 lock (_prims) 1393 lock (_prims)
1394 _prims.Remove(prim); 1394 _prims.Remove(prim.LocalID);
1395 } 1395 }
1396 1396
1397 } 1397 }
1398 1398
1399 public OdePrim getPrim(uint id)
1400 {
1401 lock (_prims)
1402 {
1403 if(_prims.ContainsKey(id))
1404 return _prims[id];
1405 else
1406 return null;
1407 }
1408 }
1409
1399 public bool havePrim(OdePrim prm) 1410 public bool havePrim(OdePrim prm)
1400 { 1411 {
1401 lock (_prims) 1412 lock (_prims)
1402 return _prims.Contains(prm); 1413 return _prims.ContainsKey(prm.LocalID);
1403 } 1414 }
1404 1415
1405 public bool haveActor(PhysicsActor actor) 1416 public bool haveActor(PhysicsActor actor)
@@ -1407,7 +1418,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
1407 if (actor is OdePrim) 1418 if (actor is OdePrim)
1408 { 1419 {
1409 lock (_prims) 1420 lock (_prims)
1410 return _prims.Contains((OdePrim)actor); 1421 return _prims.ContainsKey(((OdePrim)actor).LocalID);
1411 } 1422 }
1412 else if (actor is OdeCharacter) 1423 else if (actor is OdeCharacter)
1413 { 1424 {
@@ -1708,6 +1719,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
1708 m_rayCastManager.ProcessQueuedRequests(); 1719 m_rayCastManager.ProcessQueuedRequests();
1709 1720
1710 collision_optimized(); 1721 collision_optimized();
1722 List<OdePrim> sleepers = new List<OdePrim>();
1711 1723
1712 foreach (PhysicsActor obj in _collisionEventPrim) 1724 foreach (PhysicsActor obj in _collisionEventPrim)
1713 { 1725 {
@@ -1718,21 +1730,27 @@ namespace OpenSim.Region.PhysicsModule.ubOde
1718 { 1730 {
1719 case ActorTypes.Agent: 1731 case ActorTypes.Agent:
1720 OdeCharacter cobj = (OdeCharacter)obj; 1732 OdeCharacter cobj = (OdeCharacter)obj;
1721 cobj.AddCollisionFrameTime((int)(odetimestepMS)); 1733 cobj.SendCollisions((int)(odetimestepMS));
1722 cobj.SendCollisions();
1723 break; 1734 break;
1724 1735
1725 case ActorTypes.Prim: 1736 case ActorTypes.Prim:
1726 OdePrim pobj = (OdePrim)obj; 1737 OdePrim pobj = (OdePrim)obj;
1727 if (!pobj.m_outbounds && (pobj.Body == IntPtr.Zero || d.BodyIsEnabled(pobj.Body))) 1738 if (!pobj.m_outbounds)
1728 { 1739 {
1729 pobj.AddCollisionFrameTime((int)(odetimestepMS)); 1740 pobj.SendCollisions((int)(odetimestepMS));
1730 pobj.SendCollisions(); 1741 if(pobj.Body != IntPtr.Zero && !pobj.m_isSelected &&
1742 !pobj.m_disabled && !pobj.m_building &&
1743 !d.BodyIsEnabled(pobj.Body))
1744 sleepers.Add(pobj);
1731 } 1745 }
1732 break; 1746 break;
1733 } 1747 }
1734 } 1748 }
1735 1749
1750 foreach(OdePrim prm in sleepers)
1751 prm.SleeperAddCollisionEvents();
1752 sleepers.Clear();
1753
1736 foreach (PhysicsActor obj in _collisionEventPrimRemove) 1754 foreach (PhysicsActor obj in _collisionEventPrimRemove)
1737 _collisionEventPrim.Remove(obj); 1755 _collisionEventPrim.Remove(obj);
1738 1756
@@ -2481,7 +2499,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
2481 lock (_prims) 2499 lock (_prims)
2482 { 2500 {
2483 ChangesQueue.Clear(); 2501 ChangesQueue.Clear();
2484 foreach (OdePrim prm in _prims) 2502 foreach (OdePrim prm in _prims.Values)
2485 { 2503 {
2486 prm.DoAChange(changes.Remove, null); 2504 prm.DoAChange(changes.Remove, null);
2487 _collisionEventPrim.Remove(prm); 2505 _collisionEventPrim.Remove(prm);
@@ -2544,7 +2562,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
2544 int cnt = 0; 2562 int cnt = 0;
2545 lock (_prims) 2563 lock (_prims)
2546 { 2564 {
2547 foreach (OdePrim prm in _prims) 2565 foreach (OdePrim prm in _prims.Values)
2548 { 2566 {
2549 if (prm.CollisionScore > 0) 2567 if (prm.CollisionScore > 0)
2550 { 2568 {