diff options
Diffstat (limited to '')
-rwxr-xr-x | OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs index 6539b43..92a5f2f 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs | |||
@@ -214,7 +214,7 @@ public abstract class BSPhysObject : PhysicsActor | |||
214 | { | 214 | { |
215 | bool ret = true; | 215 | bool ret = true; |
216 | // If the 'no collision' call, force it to happen right now so quick collision_end | 216 | // If the 'no collision' call, force it to happen right now so quick collision_end |
217 | bool force = CollisionCollection.Count == 0; | 217 | bool force = (CollisionCollection.Count == 0); |
218 | 218 | ||
219 | // throttle the collisions to the number of milliseconds specified in the subscription | 219 | // throttle the collisions to the number of milliseconds specified in the subscription |
220 | if (force || (PhysicsScene.SimulationNowTime >= NextCollisionOkTime)) | 220 | if (force || (PhysicsScene.SimulationNowTime >= NextCollisionOkTime)) |
@@ -232,8 +232,10 @@ public abstract class BSPhysObject : PhysicsActor | |||
232 | // DetailLog("{0},{1}.SendCollisionUpdate,call,numCollisions={2}", LocalID, TypeName, CollisionCollection.Count); | 232 | // DetailLog("{0},{1}.SendCollisionUpdate,call,numCollisions={2}", LocalID, TypeName, CollisionCollection.Count); |
233 | base.SendCollisionUpdate(CollisionCollection); | 233 | base.SendCollisionUpdate(CollisionCollection); |
234 | 234 | ||
235 | // The collisionCollection structure is passed around in the simulator. | 235 | // The CollisionCollection instance is passed around in the simulator. |
236 | // Make sure we don't have a handle to that one and that a new one is used for next time. | 236 | // Make sure we don't have a handle to that one and that a new one is used for next time. |
237 | // This fixes an interesting 'gotcha'. If we call CollisionCollection.Clear() here, | ||
238 | // a race condition is created for the other users of this instance. | ||
237 | CollisionCollection = new CollisionEventUpdate(); | 239 | CollisionCollection = new CollisionEventUpdate(); |
238 | } | 240 | } |
239 | return ret; | 241 | return ret; |
@@ -251,7 +253,8 @@ public abstract class BSPhysObject : PhysicsActor | |||
251 | 253 | ||
252 | PhysicsScene.TaintedObject(TypeName+".SubscribeEvents", delegate() | 254 | PhysicsScene.TaintedObject(TypeName+".SubscribeEvents", delegate() |
253 | { | 255 | { |
254 | CurrentCollisionFlags = BulletSimAPI.AddToCollisionFlags2(PhysBody.ptr, CollisionFlags.BS_SUBSCRIBE_COLLISION_EVENTS); | 256 | if (PhysBody.HasPhysicalBody) |
257 | CurrentCollisionFlags = BulletSimAPI.AddToCollisionFlags2(PhysBody.ptr, CollisionFlags.BS_SUBSCRIBE_COLLISION_EVENTS); | ||
255 | }); | 258 | }); |
256 | } | 259 | } |
257 | else | 260 | else |