I'm quite new to Bullet and am programming a physics game in which I use btCompoundShape with many box shapes inside. Due to the nature of the game bodies needs to change their collision shapes quite often. In particular I am adding or removing collision shapes to the compound shape in between simulation steps. Adding new shapes works fine, but sometimes when I remove a shape from the compound shape and delete the removed shape object, I get a segmentation fault in the simulation step.
The relevant stack trace is
- btCompoundCollisionAlgorithm::processCollision
btCollisionDispatcher::defaultNearCallback
btCollisionPairCallback::processOverlap
btHashedOverlappingPairCache::processAllOverlappingPairs
btCollisionDispatcher::dispatchAllCollisionPairs
btCollisionWorld::performDiscreteCollisionDetection
btDiscreteDynamicsWorld::internalSingleStepSimulation
btDiscreteDynamicsWorld::stepSimulation
Best regards