BulletSim: fix crash when deleting llVolumeDetect enabled objects. Bullet's check for an object being linked into the world does not work for Bullet's ghost objects so BulletSim was deleting the object while it was still linked into the physical world structures.

This commit is contained in:
Robert Adams
2013-04-21 15:59:39 -07:00
parent 293a024c14
commit e1ac683154

View File

@@ -162,11 +162,8 @@ public sealed class BSShapeCollection : IDisposable
// If the caller needs to know the old body is going away, pass the event up.
if (bodyCallback != null) bodyCallback(body);
if (PhysicsScene.PE.IsInWorld(PhysicsScene.World, body))
{
PhysicsScene.PE.RemoveObjectFromWorld(PhysicsScene.World, body);
if (DDetail) DetailLog("{0},BSShapeCollection.DereferenceBody,removingFromWorld. Body={1}", body.ID, body);
}
// Removing an object not in the world is a NOOP
PhysicsScene.PE.RemoveObjectFromWorld(PhysicsScene.World, body);
// Zero any reference to the shape so it is not freed when the body is deleted.
PhysicsScene.PE.SetCollisionShape(PhysicsScene.World, body, null);