Hi there,
I've recently started using Bullet for my final project at university and have realised that a feature I really need is soft body self-collision. Is anybody working on this? If not I would be really interested in attempting to implement this feature, although the whole reason I chose to use Bullet is because my collision detection skills aren't so hot. Does anybody already have any ideas about how to do this? I can imagine a naive implementation would be to use a ghost object that mirrors the data of a soft body already in the world and perform soft vs soft collisions between these two objects, although I'm guessing this would have its drawbacks.
Thanks a lot and great job on Bullet
Dave
Anybody working on Soft Body Self-Collision?
-
- Posts: 5
- Joined: Tue Nov 11, 2008 2:20 pm
-
- Site Admin
- Posts: 4221
- Joined: Sun Jun 26, 2005 6:43 pm
- Location: California, USA
Re: Anybody working on Soft Body Self-Collision?
We plan on adding the option for soft body self-collisions.
Are you using collision clusters? It might be a good solution. You just have to exclude collisions between the same cluster. If you are not using collision clusters, just exclude collisions between connected features. The btDbvt acceleration structure can be used.
If you have some time, please try implementing this and contribute your improvements,
Thanks,
Erwin
Are you using collision clusters? It might be a good solution. You just have to exclude collisions between the same cluster. If you are not using collision clusters, just exclude collisions between connected features. The btDbvt acceleration structure can be used.
You would need to deal with exclusion of the same/connected features. It is probably best to explicitly test for self-collisions, just loop over all active btSoftbody objects, add a 'self-collision' method. You should be able to re-use a lot of the existing collision code.imagine a naive implementation would be to use a ghost object that mirrors the data of a soft body already in the world and perform soft vs soft collisions between these two objects, although I'm guessing this would have its drawbacks.
If you have some time, please try implementing this and contribute your improvements,
Thanks,
Erwin
-
- Posts: 5
- Joined: Tue Nov 11, 2008 2:20 pm
Re: Anybody working on Soft Body Self-Collision?
Hi Erwin,
I'm not using collision clusters as the shapes I am creating are not convex.
I've had a very quick look at adding a self-collision method to btSoftBody using some of the code in the defaultCollisionHandler without excluding checks between connected features but it doesn't seem to have any effect.
Which I am calling from internalSingleStepSimulation:
So I'm supposing I can use the same collision policy as CollideVF_SS as I'm still colliding nodes against faces and just create a new collide method for btDbvt which excludes connected features. What I don't understand is why this current method has absolutely no effect. Could this be something to do with the fact that I am dynamically adding nodes and faces to the soft body and am not updating the dbvt trees? I've tried calling initializeFaceTree() after adding each face but it has no effect. Maybe I should try and implement this with one of the demos first...
I'm currently working on a sort of pre-project report but it looks like self-collision is going to be one of the first things I start work on once I have finished in a few weeks time.
Cheers,
Dave
I'm not using collision clusters as the shapes I am creating are not convex.
I've had a very quick look at adding a self-collision method to btSoftBody using some of the code in the defaultCollisionHandler without excluding checks between connected features but it doesn't seem to have any effect.
Code: Select all
void btSoftBody::selfCollide() {
btSoftColliders::CollideVF_SS docollide;
/* common */
docollide.mrg = getCollisionShape()->getMargin()*2.f;
/* my nodes vs my faces */
docollide.psb[0]=this;
docollide.psb[1]=this;
docollide.psb[0]->m_ndbvt.collideTT( docollide.psb[0]->m_ndbvt.m_root, docollide.psb[1]->m_fdbvt.m_root, docollide );
}
Code: Select all
void btSoftRigidDynamicsWorld::internalSingleStepSimulation( btScalar timeStep)
{
btDiscreteDynamicsWorld::internalSingleStepSimulation( timeStep );
///solve soft bodies constraints
solveSoftBodiesConstraints();
for ( int i=0;i<m_softBodies.size();i++)
{
btSoftBody* psb=(btSoftBody*)m_softBodies[i];
psb->selfCollide();
}
///update soft bodies
updateSoftBodies();
}
I'm currently working on a sort of pre-project report but it looks like self-collision is going to be one of the first things I start work on once I have finished in a few weeks time.
Cheers,
Dave
-
- Site Admin
- Posts: 4221
- Joined: Sun Jun 26, 2005 6:43 pm
- Location: California, USA
Re: Anybody working on Soft Body Self-Collision?
A concave soft body can have multiple convex collision clusters, check the demos with a torus for example.MamboDave wrote: I'm not using collision clusters as the shapes I am creating are not convex.
It would be great if you can try to implement basic self-collisions within the existing Bullet soft body demos (before trying to apply this to dynamically changing soft bodies).Maybe I should try and implement this with one of the demos first...
Thanks,
Erwin