diff options
author | Robert Adams | 2014-06-20 21:42:08 -0700 |
---|---|---|
committer | Robert Adams | 2014-06-20 21:42:08 -0700 |
commit | 481b7c71c34167e903b8e0d65bc8932076929675 (patch) | |
tree | 4231a260d335747ffd8a5ef04d84461ec9175c4e /OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs | |
parent | Improved line map heuristics. (diff) | |
download | opensim-SC-481b7c71c34167e903b8e0d65bc8932076929675.zip opensim-SC-481b7c71c34167e903b8e0d65bc8932076929675.tar.gz opensim-SC-481b7c71c34167e903b8e0d65bc8932076929675.tar.bz2 opensim-SC-481b7c71c34167e903b8e0d65bc8932076929675.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 '')
-rwxr-xr-x | OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs | 9 |
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 |