From 1d7276235ace0ed6b7701efa36a7fd7f1b552bab Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Sun, 17 Feb 2013 20:07:04 -0800 Subject: BulletSim: add calls for creating all the different Bullet constraint types. Updated the DLLs and SOs and code for BulletXNA to create the types. All the detailed control calls are not all in place yet. --- .../Region/Physics/BulletSPlugin/BSConstraintCollection.cs | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSConstraintCollection.cs') diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSConstraintCollection.cs b/OpenSim/Region/Physics/BulletSPlugin/BSConstraintCollection.cs index 2aeff25..5c8d94e 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSConstraintCollection.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSConstraintCollection.cs @@ -117,8 +117,7 @@ public sealed class BSConstraintCollection : IDisposable if (this.TryGetConstraint(body1, body2, out constrain)) { // remove the constraint from our collection - RemoveAndDestroyConstraint(constrain); - ret = true; + ret = RemoveAndDestroyConstraint(constrain); } } @@ -126,17 +125,19 @@ public sealed class BSConstraintCollection : IDisposable } // The constraint MUST exist in the collection + // Could be called if the constraint was previously removed. + // Return 'true' if the constraint was actually removed and disposed. public bool RemoveAndDestroyConstraint(BSConstraint constrain) { + bool removed = false; lock (m_constraints) { // remove the constraint from our collection - m_constraints.Remove(constrain); + removed = m_constraints.Remove(constrain); } - // tell the engine that all its structures need to be freed + // Dispose() is safe to call multiple times constrain.Dispose(); - // we destroyed something - return true; + return removed; } // Remove all constraints that reference the passed body. -- cgit v1.1