Soft Bodies: btCompoundShapes interaction and raycast

Post Reply
Flix
Posts: 456
Joined: Tue Dec 25, 2007 1:06 pm

Soft Bodies: btCompoundShapes interaction and raycast

Post by Flix »

I don't know if the "Soft Body" part of Bullet is complete or not (BTW: many compliments to its developer/s, the demo looks impressive to me). Anyway I'd like to know:

1) btCompoundShapes don't seem to interact with soft bodies at all according to my (newbie) experiments with a cloth patch. Is this correct ?
2) Is it (or will it) be possible to ray cast to detect soft bodies ?

Thank you in advance for your answers and for the development of Bullet.

Flix.
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA
Contact:

Re: Soft Bodies: btCompoundShapes interaction and raycast

Post by Erwin Coumans »

btCompoundShape is easy to get working, and has already been fixed in Subversion:

Replace the getCollisionAlgorithm method in bullet-2.68\src\BulletSoftBody\btSoftBodyRigidBodyCollisionConfiguration.cpp by:

Code: Select all

///creation of soft-soft and soft-rigid, and otherwise fallback to base class implementation
btCollisionAlgorithmCreateFunc* btSoftBodyRigidBodyCollisionConfiguration::getCollisionAlgorithmCreateFunc(int proxyType0,int proxyType1)
{

	///try to handle the softbody interactions first

	if ((proxyType0 == SOFTBODY_SHAPE_PROXYTYPE  ) && (proxyType1==SOFTBODY_SHAPE_PROXYTYPE))
	{
		return	m_softSoftCreateFunc;
	}

	///softbody versus convex
	if (proxyType0 == SOFTBODY_SHAPE_PROXYTYPE  && btBroadphaseProxy::isConvex(proxyType1))
	{
		return	m_softRigidCreateFunc;
	}

	///convex versus soft body
	if (btBroadphaseProxy::isConvex(proxyType0) && proxyType1 == SOFTBODY_SHAPE_PROXYTYPE )
	{
		return	m_swappedSoftRigidCreateFunc;
	}

	///fallback to the regular rigid collision shape
	return btDefaultCollisionConfiguration::getCollisionAlgorithmCreateFunc(proxyType0,proxyType1);
}
Ray casting versus soft body has been implemented (press comma in the tests), but not hooked up to the btCollisionWorld::rayTest yet.

Those issues and also soft body versus concave mesh will be fixed in 2.69 (see also http://www.bulletphysics.com/Bullet/php ... 041&p=8004)
You can check out a very early prototype of soft body versus concave triangle mesh (btBvhTriangleMeshShape) here:
http://bulletphysics.com/ftp/pub/test/p ... dyDemo.zip

Hope this helps,
Erwin
Flix
Posts: 456
Joined: Tue Dec 25, 2007 1:06 pm

Re: Soft Bodies: btCompoundShapes interaction and raycast

Post by Flix »

Wonderful! Thank you.

Flix
Post Reply