From ca92cf067ee8cd32b7dbcfcaa40d9ae1cb8ee6b4 Mon Sep 17 00:00:00 2001 From: Xuchen Han Date: Mon, 7 Oct 2019 14:48:36 -0700 Subject: [PATCH] fix removeCollisionObject for Deformable world --- .../btDeformableMultiBodyDynamicsWorld.cpp | 9 +++++++++ src/BulletSoftBody/btDeformableMultiBodyDynamicsWorld.h | 2 ++ 2 files changed, 11 insertions(+) diff --git a/src/BulletSoftBody/btDeformableMultiBodyDynamicsWorld.cpp b/src/BulletSoftBody/btDeformableMultiBodyDynamicsWorld.cpp index 595ed737c..73e534d09 100644 --- a/src/BulletSoftBody/btDeformableMultiBodyDynamicsWorld.cpp +++ b/src/BulletSoftBody/btDeformableMultiBodyDynamicsWorld.cpp @@ -386,3 +386,12 @@ void btDeformableMultiBodyDynamicsWorld::removeSoftBody(btSoftBody* body) // force a reinitialize so that node indices get updated. m_deformableBodySolver->reinitialize(m_softBodies, btScalar(-1)); } + +void btDeformableMultiBodyDynamicsWorld::removeCollisionObject(btCollisionObject* collisionObject) +{ + btSoftBody* body = btSoftBody::upcast(collisionObject); + if (body) + removeSoftBody(body); + else + btDiscreteDynamicsWorld::removeCollisionObject(collisionObject); +} diff --git a/src/BulletSoftBody/btDeformableMultiBodyDynamicsWorld.h b/src/BulletSoftBody/btDeformableMultiBodyDynamicsWorld.h index e66e060f2..f618c989d 100644 --- a/src/BulletSoftBody/btDeformableMultiBodyDynamicsWorld.h +++ b/src/BulletSoftBody/btDeformableMultiBodyDynamicsWorld.h @@ -147,6 +147,8 @@ public: void removeSoftBody(btSoftBody* body); + void removeCollisionObject(btCollisionObject* collisionObject); + int getDrawFlags() const { return (m_drawFlags); } void setDrawFlags(int f) { m_drawFlags = f; }