From 376441e5507052b36279279f64896542d44ec12a Mon Sep 17 00:00:00 2001
From: Robert Adams
Date: Wed, 15 Aug 2012 16:27:30 -0700
Subject: BulletSim: make it so objects in a linkset do not generate collisions
 with each other.

---
 OpenSim/Region/Physics/BulletSPlugin/BSLinkset.cs |  7 +++++++
 OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs    | 10 ++++++++++
 OpenSim/Region/Physics/BulletSPlugin/BSScene.cs   | 12 ++++++++++--
 3 files changed, 27 insertions(+), 2 deletions(-)

(limited to 'OpenSim/Region')

diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSLinkset.cs b/OpenSim/Region/Physics/BulletSPlugin/BSLinkset.cs
index 087b9bb..1b3ba3f 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSLinkset.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSLinkset.cs
@@ -42,6 +42,9 @@ public class BSLinkset
     private BSScene m_physicsScene;
     public BSScene PhysicsScene { get { return m_physicsScene; } }
 
+    static int m_nextLinksetID = 1;
+    public int LinksetID { get; private set; }
+
     // The children under the root in this linkset
     private List<BSPrim> m_children;
 
@@ -74,6 +77,10 @@ public class BSLinkset
     public BSLinkset(BSScene scene, BSPrim parent)
     {
         // A simple linkset of one (no children)
+        LinksetID = m_nextLinksetID++;
+        // We create LOTS of linksets.
+        if (m_nextLinksetID < 0) 
+            m_nextLinksetID = 1;
         m_physicsScene = scene;
         m_linksetRoot = parent;
         m_children = new List<BSPrim>();
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
index 9c20004..c157669 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
@@ -1353,6 +1353,7 @@ public sealed class BSPrim : PhysicsActor
     }
 
     // I've collided with something
+    // Called at taint time from within the Step() function
     CollisionEventUpdate collisionCollection;
     public void Collide(uint collidingWith, ActorTypes type, OMV.Vector3 contactPoint, OMV.Vector3 contactNormal, float pentrationDepth)
     {
@@ -1366,6 +1367,15 @@ public sealed class BSPrim : PhysicsActor
         }
 
         // DetailLog("{0},BSPrim.Collison,call,with={1}", LocalID, collidingWith);
+        BSPrim collidingWithPrim;
+        if (_scene.Prims.TryGetValue(collidingWith, out collidingWithPrim))
+        {
+            // prims in the same linkset cannot collide with each other
+            if (this.Linkset.LinksetID == collidingWithPrim.Linkset.LinksetID)
+            {
+                return;
+            }
+        }
 
         // if someone is subscribed to collision events....
         if (_subscribedEventsMs != 0) {
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs
index a31c578..0a0e27e 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs
@@ -78,10 +78,16 @@ public class BSScene : PhysicsScene, IPhysicsParameters
     public string BulletSimVersion = "?";
 
     private Dictionary<uint, BSCharacter> m_avatars = new Dictionary<uint, BSCharacter>();
+    public Dictionary<uint, BSCharacter> Characters { get { return m_avatars; } }
+
     private Dictionary<uint, BSPrim> m_prims = new Dictionary<uint, BSPrim>();
+    public Dictionary<uint, BSPrim> Prims { get { return m_prims; } }
+
     private HashSet<BSCharacter> m_avatarsWithCollisions = new HashSet<BSCharacter>();
     private HashSet<BSPrim> m_primsWithCollisions = new HashSet<BSPrim>();
+
     private List<BSPrim> m_vehicles = new List<BSPrim>();
+
     private float[] m_heightMap;
     private float m_waterLevel;
     private uint m_worldID;
@@ -429,13 +435,13 @@ public class BSScene : PhysicsScene, IPhysicsParameters
         {
             numSubSteps = BulletSimAPI.PhysicsStep(m_worldID, timeStep, m_maxSubSteps, m_fixedTimeStep,
                         out updatedEntityCount, out updatedEntitiesPtr, out collidersCount, out collidersPtr);
-            // DetailLog("{0},Simulate,call, substeps={1}, updates={2}, colliders={3}", DetailLogZero, numSubSteps, updatedEntityCount, collidersCount); 
+            DetailLog("{0},Simulate,call, substeps={1}, updates={2}, colliders={3}", DetailLogZero, numSubSteps, updatedEntityCount, collidersCount); 
         }
         catch (Exception e)
         {
             m_log.WarnFormat("{0},PhysicsStep Exception: substeps={1}, updates={2}, colliders={3}, e={4}", LogHeader, numSubSteps, updatedEntityCount, collidersCount, e);
             // DetailLog("{0},PhysicsStepException,call, substeps={1}, updates={2}, colliders={3}", DetailLogZero, numSubSteps, updatedEntityCount, collidersCount);
-            // updatedEntityCount = 0;
+            updatedEntityCount = 0;
             collidersCount = 0;
         }
 
@@ -534,6 +540,8 @@ public class BSScene : PhysicsScene, IPhysicsParameters
         else if (m_avatars.ContainsKey(collidingWith))
             type = ActorTypes.Agent;
 
+        DetailLog("{0},BSScene.SendCollision,collide,id={1},with={2}", DetailLogZero, localID, collidingWith);
+
         BSPrim prim;
         if (m_prims.TryGetValue(localID, out prim)) {
             prim.Collide(collidingWith, type, collidePoint, collideNormal, penitration);
-- 
cgit v1.1


From 57a98796693cdd34efefbc9235b5d0aa765db095 Mon Sep 17 00:00:00 2001
From: Robert Adams
Date: Wed, 15 Aug 2012 16:39:00 -0700
Subject: Correct an exception report in SceneObjectPart so it outputs the
 stack.

---
 OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'OpenSim/Region')

diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index cd75224..bd6369c 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -733,7 +733,7 @@ namespace OpenSim.Region.Framework.Scenes
                     }
                     catch (Exception e)
                     {
-                        m_log.Error("[SCENEOBJECTPART]: GROUP POSITION. " + e.Message);
+                        m_log.ErrorFormat("[SCENEOBJECTPART]: GROUP POSITION. {0}", e);
                     }
                 }
                 
-- 
cgit v1.1