top of page
Search
  • Writer's pictureJosh

VEX SNIPPETS Pt.2

Updated: Jun 18, 2019

Some more helpful vex that I'm trying to type less often


1: Move to set on Grid and Set Pivot to Origin

in a point wrangle...

vector centroid = getbbox_center(0);

vector dist = centroid - 0;

vector min =getbbox_min(0); vector max =getbbox_max(0);

v@P -=dist; v@P.y+=(max[1]-min[1])/2;


2: Random pscale

in a point wrangle...

float min = chf("min");

float max = chf("max");

f@pscale=fit01(rand(@id),min,max);


3: Remove Points by Percentage

in a point wrangle...

if(rand(@id)<chf("percentage")*0.01){

removepoint(0,@ptnum);

}


4: Normals Facing Away From Point With Radius

in a point wrangle... second input is point to face away from

vector P2=point(1,"P",0);

float dist = distance(v@P,P2);

float radius = fit(dist,chf("radius"),0,0,1);


v@N = (v@P-P2)*radius;


5: Give Each Object a Unique Name by Attribute

in a point or primwrangle... credit to Nate Lapinski

s@name = sprintf("obj_%d",@id);





0 comments

Recent Posts

See All

Inverse Square Falloff

A while ago I was talking to an FX artist I work with who casually mentioned using inverse square law as a way to calculate falloff. I of course had no idea what he was talking about so I looked it up

VEX SNIPPETS Pt.1

Some helpful vex that I use on the daily 1: Center Pivot and Move to Origin in a pointwrangle.. vector centroid = getbbox_center(0); vector dist = centroid - 0; v@P -= dist; 2: Random Normal in a poin

bottom of page