moonshineTheleocat / bullet

Automatically exported from code.google.com/p/bullet
Other
0 stars 0 forks source link

Crash when Speculative Contact Restitution enabled. #787

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Hi.

I'm having a rare crash when I try to use Speculative Contact Restitution via 
btDiscreteDynamicsWorld::setApplySpeculativeContactRestitution(true) . Here's 
call stack:
btCollisionObject::getRestitution() Line 274    C++
btManifoldResult::calculateCombinedRestitution(const btCollisionObject * 
body0=0x087e7660, const btCollisionObject * body1=0x00000000) Line 58   C++
btDiscreteDynamicsWorld::integrateTransforms(float timeStep=0.00416666688) Line 
1089    C++
btDiscreteDynamicsWorld::internalSingleStepSimulation(float 
timeStep=0.00416666688) Line 508    C++
btDiscreteDynamicsWorld::stepSimulation(float timeStep=0.117000006, int 
maxSubSteps=20, float fixedTimeStep=0.00416666688) Line 452 C++

It looks that m_predictiveManifolds can sometimes contain a manifold that has 
one byRigidBody object (in my case it's a sphere shape ball) and one static 
collision object (in my case it's BVH Triangle mesh). When they're upcast()'ed 
in integrateTransforms(), second body becames NULL and shit happens. It's hard 
to reproduce this issue, I have this crash about one time at a day, but from 
looking into code I suppose it happens when CCD motion is clamped (in the 
createPredictiveContacts() ). That's why it's so rare (in my case CCD clamping 
is rather rare, on very high speeds). 

I also don't know what's the correct fix for it: it's either checking manifold 
to contain only Rigid Body objects before adding it to m_predictiveManifolds, 
or, more likely, 
changing integrateTransforms() to correctly handle such situations. I'm 
attaching a patch for the second case.

Original issue reported on code.google.com by Anton.Br...@gmail.com on 13 Jan 2014 at 2:13

Attachments:

GoogleCodeExporter commented 9 years ago
moved to https://github.com/bulletphysics/bullet3/issues/63

Original comment by erwin.coumans on 30 Mar 2014 at 5:07