favreau / bullet

Automatically exported from code.google.com/p/bullet
0 stars 0 forks source link

multipoint plane-convex collision not applied to boxes in compound shapes #547

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
In the attached demo, notice the compound-wrapped box (second from the right) 
jitters, although neither the plane box nor convex hull box have trouble.  The 
jitter for the box is identical to when the recently enabled multipoint 
contacts are disabled for a non-compound box.  I have a feeling the collision 
algorithm isn't handling the recursion on compound shapes appropriately to 
apply the multipoint to interior shapes...?

Part of the trick is that I have noticed this is sensitive to the order the 
bodies are added.  If a box is added before the ground, it is also apparently 
not considered for multipoint.  However, if the ground is also in a compound 
box, then the requirement is reversed: all boxes before ground (even compound 
boxes) are given multipoint, and only compound boxes added afterward are denied.

I'm trying to delve into the collision solver code to help patch this, but if 
you know exactly what's wrong, feel free to beat me to it ;)  Figured I'd give 
you the heads up while I'm still working on it since it looks like you're 
prepping for a release, maybe we can include the fix for this :)

Original issue reported on code.google.com by ejtt...@gmail.com on 17 Sep 2011 at 12:57

Attachments:

GoogleCodeExporter commented 9 years ago
Errr, in the version I attached, 'dropBefore' is enabled to add the boxes 
before the ground, so they all jitter.  To see the case where only the compound 
box jitters as described initially, set this to false.  Thanks!

Original comment by ejtt...@gmail.com on 17 Sep 2011 at 12:58

GoogleCodeExporter commented 9 years ago
Found it!  In setPlaneConvexMultipointIterations(), need to set values for both 
the convex-plane as well as the plane-convex cases... patch attached, seems to 
fix all the compound shape handling, which was just an artifact of which pair 
ordering the compound shape recursion wound up using.

Original comment by ejtt...@gmail.com on 17 Sep 2011 at 2:04

Attachments:

GoogleCodeExporter commented 9 years ago
good point, thanks for tracking this down!

Original comment by erwin.coumans on 18 Sep 2011 at 7:43

GoogleCodeExporter commented 9 years ago
I applied your patch as it looks fine, but haven't tested it.

By the way, we should add unit tests for everything, the unit test framework is 
there, now we just need the motivation to create tests :-)

Original comment by erwin.coumans on 19 Sep 2011 at 10:11