Search
  • Josh

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);





  • Grey LinkedIn Icon
  • Grey Vimeo Icon
  • Grey Instagram Icon
  • Artstation
  • Grey Tumblr Icon