@Cd= chramp("ramp",@Cd);
float lenV = length(v@v);
v@v = normalize(v@v)*clamp(lenV,0,4);
if (volumesample(1,"surface",@P)<0)removepoint(0,@ptnum,1);
int handle = pcopen(1,"P",@P,1,1);
vector tempV = pcfilter(handle,"N");
matrix3 m = dihedral(@vel,tempV);
vector newV = lerp(@vel*m,@vel,0.975);
@vel = newV ;
@Cd = 0;
if (dot(@N,chv("vector"))>ch("select")){
@Cd.x=1;}
else {removepoint(0,@ptnum);}
int nearPt= nearpoint(1,@P,ch("rad"));
@Cd = point(1,"Cd",nearPt);
sprintf('%04d',@Frame);
int points[] = pcfind(0,"P",@P,ch("rad"),chi("pt"));
foreach(int myPoint; points){
if (point(0,"stopped",myPoint)==0){
@Cd = set(1,0,0);
}
}
int handle = pcopen(1,"P",@P,chf("radius"),chi("numPoint"));
@Cd = pcfilter(handle,"Cd");
point(0,"P",@ptnum);
vector basePtPos = point (0,"P",chi("basepoint"));
matrix m = ident();
v@Z_axis =normalize( basePtPos - point(0,"P",neighbour(0,chi("basepoint"),1)));
v@Y_axis =normalize( cross(@Z_axis,basePtPos-point(0,"P",neighbour(0,chi("basepoint"),0))))*1;
v@X_axis =normalize ( cross (@Z_axis,@Y_axis))*-1 ;
m*= set (@X_axis,@Y_axis,@Z_axis);
//rotate
float angleX = radians(ch("angleX"));
vector axisX = {1,0,0};
rotate(m,angleX,axisX);
float angleY = radians(ch("angleY"));
vector axisY = {0,1,0};
rotate(m,angleY,axisY);
float angleZ = radians(ch("angleZ"));
vector axisZ = {0,0,1};
rotate(m,angleZ,axisZ);
translate (m,basePtPos);
4@myMatrix = m;
m=invert(m);
@P*= m;
float min = chf("min");
float max = chf("max");
float val = rand(@id);
val = fit01( pow( val, chi("pow")), min, max);
f@pscale = val;
// check si il y a un att id sur les points
if (haspointattrib(0,"id")==0 ){@id = @ptnum;}
// random globale
@pscale = fit01(rand(@id+454654),ch("min"),ch("max"));
// pourcentage des plus gros
if (rand(@id+987)<ch("pctDePlusGros")){
@pscale = fit01(rand(@id+454654),ch("minGros"),ch("maxGros"));
}
// un scale globale
@pscale *= ch("globalMult");
if (@Cd.x<chf("seuilColor"))removepoint(0,@ptnum);
VEX