Bullet & using Constraint Hierarchies(aka Ragdolls) with CCD

Post Reply
VicariousEnt
Posts: 50
Joined: Fri Oct 29, 2010 1:37 am

Bullet & using Constraint Hierarchies(aka Ragdolls) with CCD

Post by VicariousEnt »

The short answer, it doesn't work currently as is. In our game we have ragdolls that can fall off of high enough structures that some of their smaller body parts will become embedded in the ground without the Continuous Collision System enabled on them. With CCD enabled, ragdolls will collide with themselves during fast falls and then break apart and leave pieces stuck in the air. I've submitted a version of the ragdoll demo with CCD enabled that demonstrates this problem well in Issue 356. We've been running with a crippled CCD system for quite some time, waiting for a release of Bullet to come out with a fix for this issue, hoping it was the same cause of our problem.

The CCD fixes in 2.81 I'm sure fix the original issue listed in issue 356, but even the predictive contacts added to the constraint solver don't fix our problem. In fact I'm pretty sure they make it worse, slower speed falls seem to trigger the problem now. Anyways, I finally realized that the problem was that the body parts, or separate RBs of a hierarchy (this problem doesn't just apply to ragdolls), were colliding with each other in the ccd convexSweepTest calls. I'm still unsure as to why the collision response for these hits result in RBs being deactivated and frozen mid air. Perhaps it has to do with this comment in the collision response section of btDiscreteDynamicsWorld::integrateTransforms (were CCD is implemented), line 1061..

//don't apply the collision response right now, it will happen next frame
//if you really need to, you can uncomment next 3 lines. Note that is uses zero restitution.


Regardless, the cause is obvious so I was able to fix our issue by switching the Collision Filter Mask of these convexSweepTest calls in Bullet (there are 2 now that the predictive contacts are added) to the btBroadphaseProxy::StaticFilter and voila, problem solved. For us anyways. This change will break all dynamic object vs dynamic object CCD, which our game has none of (CCD only used for colliding dynamic vs static objects). If Bullet had some kind of custom filter set internally in this case that insures rigid bodies in constraint hierarchies don’t perform ccd tests on the other RBs within the same hierarchy, this problem could be avoided. You can’t really use the built in filter system for this as you only want these objects to exclude each other on the ccd sweep tests, they still need to collide with each other under normal circumstances. Its possible even that that solution may still be incorrect and allow penetration. We have seen an occasional case were a ragdoll falls hard in a corner and lands on an arm and manages to push the hand through the ground, but it’s a rare enough of an occurrence now that we can live with that. I’m not familiar enough with the order of operations and solver algorithm in Bullet to say in this scenario whether the collision response of the hand vs torso collision can bypass the ccd system or vice a versa.

So that’s where it’s at. Looking forward to seeing how this issue is dealt with and hoping this post will help anyone else who requires the use of these 2 systems simultaneously until then. Submitted Issue 669 on this problem.
Post Reply