I've been trying to use the "pressure" coefficient (kPR) in a soft body - to emulate the behaviour in the "Pressure" bullet soft body demo - without any luck. Every time I change kPR to anything other than 0, the soft body gets extremely unstable and explodes. Since kPR is used very little in the source code, I was able to find pretty much only one place that could cause problems, namely this line in btSoftBody.cpp:
Up until this point, my simulations had been using a kPR of 0, so ivolumetp - which contributes to node forces, and hence is a likely culprit for explosion - always got zero'd out. However even when I try very small values of kPR, the soft body blows up. So on a hunch I printed the output of softBody->getVolume(), which is where the value for "volume" in the above line of code comes from. Sure enough, I was getting values like 0.000001, 0.000027, and 0.000153 on three separate tests, which cause the quotient in the first part of the ivolumetp calculation to be very large. I don't believe those volumes should be correct. The soft body I was testing was a rough sphere shape of diameter 5 (in 2 of the tests) and 10 (in the 3rd test), so it should definitely have a much larger volume than the values I was getting. The only thing I could think of was that the vertices were in the wrong order, but reversing them just gave me negative (though equally small) volume values, so I assume my first vertex winding order was indeed correct.
If anyone has any clues/ideas as to what is going on here, I'd much appreciate it.