Softbody collision problem

Post Reply
yang
Posts: 11
Joined: Thu Oct 30, 2014 2:40 pm

Softbody collision problem

Post by yang »

Hi,
I want to know if a softbody is colliding with rigid body or not.
what should I do?

I can get the colliding information of a rigid body by the code below, But when it comes to be a softbody,
"collisionPairs" is always 0 even through it is colliding with a rigid body.

Code: Select all

int collisionPairs = mp_btDynamicsWorld->getDispatcher()->getNumManifolds(); // collision pairs
	for (int i = 0; i < collisionPairs; i++)
	{
		btPersistentManifold* contactManifold =  mp_btDynamicsWorld->getDispatcher()->getManifoldByIndexInternal(i);
		btCollisionObject* obA = const_cast<btCollisionObject*>(contactManifold->getBody0());
		btCollisionObject* obB = const_cast<btCollisionObject*>(contactManifold->getBody1());
		string *s1 = static_cast<string*>(obA->getUserPointer());
		string *s2 = static_cast<string*>(obB->getUserPointer());
                //..do something
         }
Flix
Posts: 456
Joined: Tue Dec 25, 2007 1:06 pm

Re: Softbody collision problem

Post by Flix »

No wonder! It's always been like that :)

And that's one of the two reasons why I've stopped using soft bodies some year ago (the other reason is that soft bodies never go to sleep).

P.S. Some user might argue that there could be other ways to check for collisions between rigid bodies and soft bodies (maybe traversing the btSoftBody class fields at each frame), but that was not a good solution for me :oops:
Post Reply