Showing posts with label match. Show all posts
Showing posts with label match. Show all posts

Thursday, 27 October 2022

"shrinkwrap" push faces from one object towards another

More Julian scripting
Use case - an object lying on the floor is not quite touching the surface - so lets pull points of the floor toward the surface. The floor object would go into the first input and the object to "wrap" to goes into the 2nd input. Put this code into a point wrangle -

 i@prim;

v@uvw;

@dist = xyzdist(1, @P, @prim, @uvw);

@bias = fit(@dist, 0, .01, .79, 0);

@P = lerp(@P, primuv(1, "P", @prim, @uvw), @bias);


It might be necessary to play with the "fit" values & ensure the objects are kinda close to each other to begin with! This is good for bodge fixing stuff!


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!".