Reset cached collisions

Post Reply
jgdo
Posts: 1
Joined: Wed Feb 03, 2016 2:33 pm

Reset cached collisions

Post by jgdo »

Hi,

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
I assume that Bullet caches detected collisions between simulation steps instead of completely re-computing all of them every time. Is this correct? And if so, is there any way to delete this cache and force bullet to re-compute all collisions from the top for the next time step?

Best regards
Post Reply