//Do some funky business by using the average from another mesh
int pc = pcopen(1, 'P', @P, ch('d'), chi('amnt'));
@P = pcfilter(pc, 'P');
//For colour
//@Cd = pcfilter(pc, 'Cd');
//For velocity
//@v = pcfilter(pc, 'v');
//Do some funky business by using a point in another mesh
int pts[] = nearpoints(1,@P,ch('distance'),chi('maxPts'));
int samplePoint = chi("samplePoint")
@v = point(1,'v',samplePoint);
int match = findattribval(1,"point","id",@id,0);
if(match!=-1){
//Matched!
}
int targetMesh = pcopen(1, "P", @P, chf("distance"), chi("maxPoints"));
vector targetPos = pcfilter(targetMesh, "P");
int numpts = pcnumfound(handle);
vector toTarget;
if(numpts>=1)toTarget = @P-targetPos;
else toTarget = set(0,0,0);
@P -= toTarget;
//Run on primitives
addpoint(0, @P);
removeprim(0, @primnum, 1);
if (rand(float(@ptnum)+ch("seed")) > ch("threshold")){
//Group em
i@group_trim = 1;
//Or delete em
//removepoint(0,@ptnum);
}
float colormaker = curlnoise(@P*ch("frequency"));
@Cd = vector(chramp('myramp',colormaker));
@normLife = 1-(@age/@life);
@Cd = vector(chramp('myramp',@normLife));
//Pro tip. Drive the angle and scale with an attribute.
float angle = ch("angle");
vector scale = chv("scale");
//Pro tip. Use a vector like v@up or v@N to do useful things
vector axis = chv("axis");
//Get the current transform
matrix3 m = ident();
//rotate it
rotate(m, radians(angle), axis);
//scale it
scale(m, scale);
setprimintrinsic(0, ‘transform’, @ptnum, m, ‘set’);