aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics
diff options
context:
space:
mode:
authorRobert Adams2012-08-15 16:27:30 -0700
committerRobert Adams2012-08-15 16:29:50 -0700
commit376441e5507052b36279279f64896542d44ec12a (patch)
tree0dd9e1df759f76eb516c1ce5efca1829f658d76e /OpenSim/Region/Physics
parentBulletSim: update DLLs and SOs to fix the problem with avatars jumping around... (diff)
downloadopensim-SC-376441e5507052b36279279f64896542d44ec12a.zip
opensim-SC-376441e5507052b36279279f64896542d44ec12a.tar.gz
opensim-SC-376441e5507052b36279279f64896542d44ec12a.tar.bz2
opensim-SC-376441e5507052b36279279f64896542d44ec12a.tar.xz
BulletSim: make it so objects in a linkset do not generate collisions with each other.
Diffstat (limited to 'OpenSim/Region/Physics')
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSLinkset.cs7
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs10
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSScene.cs12
3 files changed, 27 insertions, 2 deletions
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
42 private BSScene m_physicsScene; 42 private BSScene m_physicsScene;
43 public BSScene PhysicsScene { get { return m_physicsScene; } } 43 public BSScene PhysicsScene { get { return m_physicsScene; } }
44 44
45 static int m_nextLinksetID = 1;
46 public int LinksetID { get; private set; }
47
45 // The children under the root in this linkset 48 // The children under the root in this linkset
46 private List<BSPrim> m_children; 49 private List<BSPrim> m_children;
47 50
@@ -74,6 +77,10 @@ public class BSLinkset
74 public BSLinkset(BSScene scene, BSPrim parent) 77 public BSLinkset(BSScene scene, BSPrim parent)
75 { 78 {
76 // A simple linkset of one (no children) 79 // A simple linkset of one (no children)
80 LinksetID = m_nextLinksetID++;
81 // We create LOTS of linksets.
82 if (m_nextLinksetID < 0)
83 m_nextLinksetID = 1;
77 m_physicsScene = scene; 84 m_physicsScene = scene;
78 m_linksetRoot = parent; 85 m_linksetRoot = parent;
79 m_children = new List<BSPrim>(); 86 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
1353 } 1353 }
1354 1354
1355 // I've collided with something 1355 // I've collided with something
1356 // Called at taint time from within the Step() function
1356 CollisionEventUpdate collisionCollection; 1357 CollisionEventUpdate collisionCollection;
1357 public void Collide(uint collidingWith, ActorTypes type, OMV.Vector3 contactPoint, OMV.Vector3 contactNormal, float pentrationDepth) 1358 public void Collide(uint collidingWith, ActorTypes type, OMV.Vector3 contactPoint, OMV.Vector3 contactNormal, float pentrationDepth)
1358 { 1359 {
@@ -1366,6 +1367,15 @@ public sealed class BSPrim : PhysicsActor
1366 } 1367 }
1367 1368
1368 // DetailLog("{0},BSPrim.Collison,call,with={1}", LocalID, collidingWith); 1369 // DetailLog("{0},BSPrim.Collison,call,with={1}", LocalID, collidingWith);
1370 BSPrim collidingWithPrim;
1371 if (_scene.Prims.TryGetValue(collidingWith, out collidingWithPrim))
1372 {
1373 // prims in the same linkset cannot collide with each other
1374 if (this.Linkset.LinksetID == collidingWithPrim.Linkset.LinksetID)
1375 {
1376 return;
1377 }
1378 }
1369 1379
1370 // if someone is subscribed to collision events.... 1380 // if someone is subscribed to collision events....
1371 if (_subscribedEventsMs != 0) { 1381 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
78 public string BulletSimVersion = "?"; 78 public string BulletSimVersion = "?";
79 79
80 private Dictionary<uint, BSCharacter> m_avatars = new Dictionary<uint, BSCharacter>(); 80 private Dictionary<uint, BSCharacter> m_avatars = new Dictionary<uint, BSCharacter>();
81 public Dictionary<uint, BSCharacter> Characters { get { return m_avatars; } }
82
81 private Dictionary<uint, BSPrim> m_prims = new Dictionary<uint, BSPrim>(); 83 private Dictionary<uint, BSPrim> m_prims = new Dictionary<uint, BSPrim>();
84 public Dictionary<uint, BSPrim> Prims { get { return m_prims; } }
85
82 private HashSet<BSCharacter> m_avatarsWithCollisions = new HashSet<BSCharacter>(); 86 private HashSet<BSCharacter> m_avatarsWithCollisions = new HashSet<BSCharacter>();
83 private HashSet<BSPrim> m_primsWithCollisions = new HashSet<BSPrim>(); 87 private HashSet<BSPrim> m_primsWithCollisions = new HashSet<BSPrim>();
88
84 private List<BSPrim> m_vehicles = new List<BSPrim>(); 89 private List<BSPrim> m_vehicles = new List<BSPrim>();
90
85 private float[] m_heightMap; 91 private float[] m_heightMap;
86 private float m_waterLevel; 92 private float m_waterLevel;
87 private uint m_worldID; 93 private uint m_worldID;
@@ -429,13 +435,13 @@ public class BSScene : PhysicsScene, IPhysicsParameters
429 { 435 {
430 numSubSteps = BulletSimAPI.PhysicsStep(m_worldID, timeStep, m_maxSubSteps, m_fixedTimeStep, 436 numSubSteps = BulletSimAPI.PhysicsStep(m_worldID, timeStep, m_maxSubSteps, m_fixedTimeStep,
431 out updatedEntityCount, out updatedEntitiesPtr, out collidersCount, out collidersPtr); 437 out updatedEntityCount, out updatedEntitiesPtr, out collidersCount, out collidersPtr);
432 // DetailLog("{0},Simulate,call, substeps={1}, updates={2}, colliders={3}", DetailLogZero, numSubSteps, updatedEntityCount, collidersCount); 438 DetailLog("{0},Simulate,call, substeps={1}, updates={2}, colliders={3}", DetailLogZero, numSubSteps, updatedEntityCount, collidersCount);
433 } 439 }
434 catch (Exception e) 440 catch (Exception e)
435 { 441 {
436 m_log.WarnFormat("{0},PhysicsStep Exception: substeps={1}, updates={2}, colliders={3}, e={4}", LogHeader, numSubSteps, updatedEntityCount, collidersCount, e); 442 m_log.WarnFormat("{0},PhysicsStep Exception: substeps={1}, updates={2}, colliders={3}, e={4}", LogHeader, numSubSteps, updatedEntityCount, collidersCount, e);
437 // DetailLog("{0},PhysicsStepException,call, substeps={1}, updates={2}, colliders={3}", DetailLogZero, numSubSteps, updatedEntityCount, collidersCount); 443 // DetailLog("{0},PhysicsStepException,call, substeps={1}, updates={2}, colliders={3}", DetailLogZero, numSubSteps, updatedEntityCount, collidersCount);
438 // updatedEntityCount = 0; 444 updatedEntityCount = 0;
439 collidersCount = 0; 445 collidersCount = 0;
440 } 446 }
441 447
@@ -534,6 +540,8 @@ public class BSScene : PhysicsScene, IPhysicsParameters
534 else if (m_avatars.ContainsKey(collidingWith)) 540 else if (m_avatars.ContainsKey(collidingWith))
535 type = ActorTypes.Agent; 541 type = ActorTypes.Agent;
536 542
543 DetailLog("{0},BSScene.SendCollision,collide,id={1},with={2}", DetailLogZero, localID, collidingWith);
544
537 BSPrim prim; 545 BSPrim prim;
538 if (m_prims.TryGetValue(localID, out prim)) { 546 if (m_prims.TryGetValue(localID, out prim)) {
539 prim.Collide(collidingWith, type, collidePoint, collideNormal, penitration); 547 prim.Collide(collidingWith, type, collidePoint, collideNormal, penitration);