Monday 6 May 2019

Cantor Pairing For Impact Data And Generating Dynamic Bullet Constraints






There have been some fantastic resources for demonstrating how to create dynamic constraints in Bullet - most notably Rich Lord's stuff and, as usual, examples on Matt Estela's site.

The process, however, of establishing which collisions took place between which objects can be quite tricky and intensive - particularly as the Impact Data which records this stuff contains many duplicates of impacts between the same objects across multiple substeps. Usually you'd use a few For Loops to rationalise and structure this data.

The scene below uses a simple pairing formula called Cantor Pairing to essentially encode a collision between a pair of objects into a single number - it's then very easy to see if that collision has happened before and/or to remove duplicates of that collision. It also seems to be quite fast.

The sample scene does that encoding and then establishes constraints dynamically at impact points. I think (hope) it's as simple as it can get but, as always with Houdini, there are probably better ways.

hipfile.

No comments:

Post a Comment