aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs
diff options
context:
space:
mode:
authorRobert Adams2014-06-20 21:42:08 -0700
committerJustin Clark-Casey2014-08-02 00:49:39 +0100
commit5edffc9ecd8f50b9e1f6b267d2ad60f5b8a43dd7 (patch)
tree64c52fa75388a6c4f551623d599c0cd385f17b9a /OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs
parentImproved line map heuristics. (diff)
downloadopensim-SC_OLD-5edffc9ecd8f50b9e1f6b267d2ad60f5b8a43dd7.zip
opensim-SC_OLD-5edffc9ecd8f50b9e1f6b267d2ad60f5b8a43dd7.tar.gz
opensim-SC_OLD-5edffc9ecd8f50b9e1f6b267d2ad60f5b8a43dd7.tar.bz2
opensim-SC_OLD-5edffc9ecd8f50b9e1f6b267d2ad60f5b8a43dd7.tar.xz
BulletSim: add some locking for collision lists to prevent collsions
from locking up when running BulletSim on a separate thread.
Diffstat (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs')
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs9
1 files changed, 7 insertions, 2 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs
index f89b376..7a46550 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs
@@ -462,7 +462,10 @@ public abstract class BSPhysObject : PhysicsActor
462 462
463 // If someone has subscribed for collision events log the collision so it will be reported up 463 // If someone has subscribed for collision events log the collision so it will be reported up
464 if (SubscribedEvents()) { 464 if (SubscribedEvents()) {
465 CollisionCollection.AddCollider(collidingWith, new ContactPoint(contactPoint, contactNormal, pentrationDepth)); 465 lock (PhysScene.CollisionLock)
466 {
467 CollisionCollection.AddCollider(collidingWith, new ContactPoint(contactPoint, contactNormal, pentrationDepth));
468 }
466 DetailLog("{0},{1}.Collison.AddCollider,call,with={2},point={3},normal={4},depth={5},colliderMoving={6}", 469 DetailLog("{0},{1}.Collison.AddCollider,call,with={2},point={3},normal={4},depth={5},colliderMoving={6}",
467 LocalID, TypeName, collidingWith, contactPoint, contactNormal, pentrationDepth, ColliderIsMoving); 470 LocalID, TypeName, collidingWith, contactPoint, contactNormal, pentrationDepth, ColliderIsMoving);
468 471
@@ -474,12 +477,14 @@ public abstract class BSPhysObject : PhysicsActor
474 // Send the collected collisions into the simulator. 477 // Send the collected collisions into the simulator.
475 // Called at taint time from within the Step() function thus no locking problems 478 // Called at taint time from within the Step() function thus no locking problems
476 // with CollisionCollection and ObjectsWithNoMoreCollisions. 479 // with CollisionCollection and ObjectsWithNoMoreCollisions.
480 // Called with BSScene.CollisionLock locked to protect the collision lists.
477 // Return 'true' if there were some actual collisions passed up 481 // Return 'true' if there were some actual collisions passed up
478 public virtual bool SendCollisions() 482 public virtual bool SendCollisions()
479 { 483 {
480 bool ret = true; 484 bool ret = true;
481 485
482 // If the 'no collision' call, force it to happen right now so quick collision_end 486 // If no collisions this call but there were collisions last call, force the collision
487 // event to be happen right now so quick collision_end.
483 bool force = (CollisionCollection.Count == 0 && CollisionsLastReported.Count != 0); 488 bool force = (CollisionCollection.Count == 0 && CollisionsLastReported.Count != 0);
484 489
485 // throttle the collisions to the number of milliseconds specified in the subscription 490 // throttle the collisions to the number of milliseconds specified in the subscription