Disable Collisions - alanjfs/houdini_wiki GitHub Wiki

How do you disable collisions between a pair of rigid bodies?

Using @collisiongroup and @collisionignore

The RBD Packed Object documentation lists two attributes involving collisions that are of relevance.

  • @collisiongroup Add an object to a group
  • @collisionignore Exclude collisions with objects in a group
s@collisiongroup = "boxes";
s@collisionignore = "boxes";

Thus, both adding and ignoring objects of the same group results in everything in the group acting independently.

Using Constraints

Another method is making a Hard Constraint that does nothing except disable collisions.

disablecollisions.zip

disablecollisions2

Walkthrough

Let's go through the wrangles first.

setup_boxes

Running over points, this merely adds a unique name and offsets each box into a 3x3 grid.

int i = detail(1, "iteration");

int row = i / 3;
int col = i % 3;
vector pos = set(col, row, 0);

v@P += pos * chv("offset") + { 0, 1, 0 };
s@name = sprintf("box%d", i);

create_null_constraints

Also running over points, this adds a constraint between each packed primitive, and every other packed primitive. Disabling of collisions is specified between exactly two pairs of rigid bodies, so we'll do it pow(2, number_of_rigids) times.

int others[] = expandpointgroup(0, "");

// Constrain this point to all other points
for (int other : others) {
    if (other == @ptnum) continue;

    int con = addprim(0, "polyline", @ptnum, other);
    setprimattrib(0, "constraint_name", con, "Hard");
    setprimattrib(0, "constraint_type", con, "position");
}

i@condof = 0; // Free movement

DOP Network

Nothing fancy, there's a packe rigid body along with a constraint network, to bring in geometry from the first and second context input of the network.

image