Page 1 of 1

Soft Bodies: btCompoundShapes interaction and raycast

Posted: Sun Apr 20, 2008 9:14 am
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.

Re: Soft Bodies: btCompoundShapes interaction and raycast

Posted: Sun Apr 20, 2008 3:53 pm
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

Re: Soft Bodies: btCompoundShapes interaction and raycast

Posted: Tue Apr 22, 2008 12:50 pm
by Flix
Wonderful! Thank you.

Flix