BulletSim: Refactor BSConstraintCollection to add a new RemoveAndDestroyConstraint(BSConstraint xx)
parent
c1c1d48af1
commit
77a7758cf5
|
@ -112,16 +112,24 @@ public class BSConstraintCollection : IDisposable
|
||||||
{
|
{
|
||||||
m_world.scene.DetailLog("{0},BSConstraintCollection.RemoveAndDestroyConstraint,taint,body1={1},body2={2}", BSScene.DetailLogZero, body1.ID, body2.ID);
|
m_world.scene.DetailLog("{0},BSConstraintCollection.RemoveAndDestroyConstraint,taint,body1={1},body2={2}", BSScene.DetailLogZero, body1.ID, body2.ID);
|
||||||
// remove the constraint from our collection
|
// remove the constraint from our collection
|
||||||
m_constraints.Remove(constrain);
|
RemoveAndDestroyConstraint(constrain);
|
||||||
// tell the engine that all its structures need to be freed
|
|
||||||
constrain.Dispose();
|
|
||||||
// we destroyed something
|
|
||||||
ret = true;
|
ret = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// The constraint MUST exist in the collection
|
||||||
|
public bool RemoveAndDestroyConstraint(BSConstraint constrain)
|
||||||
|
{
|
||||||
|
// remove the constraint from our collection
|
||||||
|
m_constraints.Remove(constrain);
|
||||||
|
// tell the engine that all its structures need to be freed
|
||||||
|
constrain.Dispose();
|
||||||
|
// we destroyed something
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
// Remove all constraints that reference the passed body.
|
// Remove all constraints that reference the passed body.
|
||||||
// Return 'true' if any constraints were destroyed.
|
// Return 'true' if any constraints were destroyed.
|
||||||
public bool RemoveAndDestroyConstraint(BulletBody body1)
|
public bool RemoveAndDestroyConstraint(BulletBody body1)
|
||||||
|
|
Loading…
Reference in New Issue