Softbody and rigidbody collisions (solved)

prager
Posts: 2
Joined: Fri Apr 24, 2009 10:53 am

Softbody and rigidbody collisions (solved)

Post by prager »

Hey,

I am trying to create a cloth simulation on an articulated figure - skirt on a skinned model, with not much luck so far...

I have the cloth simulation working, but the collisions with rigid body objects seem to be based on a very large bounding volume around the softbody object (the collisions between two rigid bodies are solved relatively accurately). I am really sorry for my ignorant question, but is there any way to do the collision detection accurately?

Thank you!
Last edited by prager on Wed Apr 29, 2009 1:00 pm, edited 1 time in total.
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA

Re: Softbody and rigidbody collisions

Post by Erwin Coumans »

Unfortunately the gap has a reason: it makes soft body collision detection more robust.

You can try to reduce the gap, by setting a smaller value for the collision margin of soft bodies.
For example:

Code: Select all

softBody->getCollisionShape()->setMargin(0.05);
The default soft body margin is 0.25, and smaller values will likely result in artifacts, such as unreliable collision detection. You can improve support for smaller margins by compensating and using a smaller default internal timestep:

Code: Select all

#define FIXED_240_HERTZ_SUBSTEP 1./240.
dynamicsWorld->stepSimulation(deltaTimeInSeconds, 10, FIXED_240_HERTZ_SUBSTEP);
Thanks,
Erwin
prager
Posts: 2
Joined: Fri Apr 24, 2009 10:53 am

Re: Softbody and rigidbody collisions (solved)

Post by prager »

Thank you! That is exactly what I needed to know.

Martin