Hi all. First I want to say how great Bullet Physics is. I've been able to pull together something cool in a ridiculously short amount of time. I started with rigid bodies, based on the HelloWorld and Ragdoll demos, and everything was working great. Now I'm trying to add soft bodies, based on the SoftBody demo, and I've run into a problem.
As soon as I add a soft body and try to time propagate the simulation, it gets a division by zero error in btSparseSDF::Evaluate, in this line
Cell*& root=cells[static_cast<int>(h%cells.size())];
The whole stack trace is below. I'm trying to set up the physics just like in the SoftBody demo, and then create the soft body (a rope) like in ClothAttach. I'm not sure what I'm missing, and the whole code is a bit long to post. Does anyone have any ideas, just based on where it's failing? At least whether it's something in the physics setup or the soft body creating itself? I guess otherwise I'll have to strip the code down to its essentials so it's short enough for someone to look at.
thanks,
Noam
0 test_GL 0x000000010009942a btSparseSdf<3>::Evaluate(btVector3 const&, btCollisionShape const*, btVector3&, float) + 632
1 test_GL 0x00000001000732be btSoftBody::checkContact(btCollisionObjectWrapper const*, btVector3 const&, float, btSoftBody::sCti&) const + 2042
2 test_GL 0x00000001000a06d9 btSoftColliders::CollideSDF_RS::DoNode(btSoftBody::Node&) const + 183
3 test_GL 0x00000001000a1805 btSoftColliders::CollideSDF_RS::Process(btDbvtNode const*) + 41
4 test_GL 0x00000001000a01f3 btDbvt::collideTV(btDbvtNode const*, btDbvtAabbMm const&, btDbvt::ICollide&) const + 4253
5 test_GL 0x000000010006ff2e btSoftBody::defaultCollisionHandler(btCollisionObjectWrapper const*) + 1738
6 test_GL 0x00000001000c6ab9 btDefaultSoftBodySolver::processCollision(btSoftBody*, btCollisionObjectWrapper const*) + 33
7 test_GL 0x00000001000c300a btSoftRigidCollisionAlgorithm::processCollision(btCollisionObjectWrapper const*, btCollisionObjectWrapper const*, btDispatcherInfo const&, btManifoldResult*) + 232
8 test_GL 0x0000000100188157 btCollisionDispatcher::defaultNearCallback(btBroadphasePair&, btCollisionDispatcher&, btDispatcherInfo const&) + 403
9 test_GL 0x0000000100188c6a btCollisionPairCallback::processOverlap(btBroadphasePair&) + 54
10 test_GL 0x000000010016ec41 btHashedOverlappingPairCache::processAllOverlappingPairs(btOverlapCallback*, btDispatcher*) + 99
11 test_GL 0x00000001001878b7 btCollisionDispatcher::dispatchAllCollisionPairs(btOverlappingPairCache*, btDispatcherInfo const&, btDispatcher*) + 69
12 test_GL 0x000000010018a68c btCollisionWorld::performDiscreteCollisionDetection() + 194
13 test_GL 0x000000010014acbd btDiscreteDynamicsWorld::internalSingleStepSimulation(float) + 197
14 test_GL 0x00000001000c39cd btSoftRigidDynamicsWorld::internalSingleStepSimulation(float) + 117
15 test_GL 0x000000010013d269 btDiscreteDynamicsWorld::stepSimulation(float, int, float) + 511
16 test_GL 0x00000001000029b1 testDemo::clientMoveAndDisplay() + 553 (test_GL.cpp:891)
17 test_GL 0x000000010003110c DemoApplication::moveAndDisplay() + 50
18 test_GL 0x00000001000489a3 glutMoveAndDisplayCallback() + 16
19 test_GL 0x0000000100048a9e glutmain(int, char**, int, int, char const*, DemoApplication*) + 249
20 test_GL 0x00000001000020d2 main + 351 (test_GL.cpp:1034)
21 test_GL 0x0000000100001a54 start + 52
division by zero in btSparseSDF::Evaluate
-
- Posts: 2
- Joined: Sat Aug 24, 2013 4:41 pm
Re: division by zero in btSparseSDF::Evaluate
Never mind. Of course, the act of posting was immediately followed by figuring out the problem. I tried to add the SoftBody before doing the sparsesdf.initialize() call. Now it's working, or at least not crashing.
Noam
Noam