Tuesday, 16 April 2019

Check names for duplicates

point wrangle snippet from Mike

int find = findattribval(0,"point","name",s@name);
int count = findattribvalcount(0,"point","name",s@name);
i@find = find;
i@count = count;

Friday, 12 April 2019

solver sop and moving geometry

So, the Solver SOP doesn't behave as "I" expected with animated (ie. moving) points/geo.

You need to manually update the position if you want your geo to still move!
SOOOOOOOOOO. Inside the solver, copy the P (for position) attribute from Input 1 to Prev Frame...

Weird stuff. But hey.

removing RBD from a sim

Sometimes you need to remove an RBD from a sim completely. Eg, you're using a block to push something and then need it to get out of the way...

Make sure you have a group for it on SOP level. It will probably be a point group, as you're most likely using packed geo.

Now use a SOP solver in your DOP network. Attach it to a multisolver, alongside your Bullet/RBD solver..
Inside the SOP solver, blast the group that you created earlier. Use a switch node or some other timing device (you could use a point wrangle with removepoint I think)  to trigger the group's deletion.
Eg. Switch node  could use $F>1000. Here it will switch from "all the geo" to "all the geo minus the group" input.

Select a random point from a group each frame

Some code snippets from Walter to use points from a group randomly, for emission (or other things)

In a Detail Attribute Wrangle-

int npts = npoints(0);
float keep = rand(@Time + 235.624) * npts;
i@keep = int(keep);

Every time step, a random point id is chosen as the "keep" point.

Then in a blast, we kill everything but the kept point

`detail(0, "keep", 0)`

Don't forget to invert the blast selection

Saturday, 6 April 2019

Bullets solver, setting or changing attributes

Bullet solver is a bit strange in Houdini. It might not update values as you expect. Eg, you're trying to change the @active value using a sop-solver.
One solution is to use the Bullet mode in the RBD Solver. This usually works..But it might be slower? I think it has a multi solver built into it..

Another way to make it work is by utilising a multi solver and the Geometry Wrangle. This will let you access the SOP level stuff (there is an input tab you can mess around with)

So, your input RBD goes into the first input of the multi solver, then your Bullet Solver and any Geo Wrangles go into the purple input of the multi solver..

Friday, 5 April 2019

Wednesday, 3 April 2019

match, finding a string in a wrangle. Wildcards.

in Blast nodes you can use wildcards * all over the place
eg. @name=*something
will kill anything with "something" in it's name attribute. It's a little different when you want to select things in this manner in a wrangle. We use the "match" function to do this-


if(match("*stick*",@name)){

s@value="yeah!";


}

Here we look for the string "stick" in the attribute "name". On success, we make "value" equal to "yeah!".