int handle = pcopen(2,"P",@P,chf("radius"),chi("numPoint"));
vector pos = pcfilter(handle,"P");
vector curveDir = pcfilter(handle,"tangentu");
vector toCurve = normalize(pos-v@P);
vector centrifuge = normalize(cross(curveDir,toCurve));
float globForceScale = ch("globalMult");
v@force += curveDir*ch("curveDirMuilt")*-1*globForceScale;
v@force += centrifuge*ch("centMult")*globForceScale;
v@force += toCurve*ch("toCurveMult")*globForceScale;
//custom buyoncy
float strength =1;
vector dir = set(0,0,1);
@vel += strength * @temperature * dir;
if (volumesample(1,"surface",@P)<0){
@Cd = set(1,0,0);
matrix3 m = dihedral(@v,{1,0,0});
vector newV = lerp(@v*m,@v,0.9);
@v = newV ;
}
int handle = pcopen(1,"P",@P,1,40);
vector tempV = pcfilter(handle,"N")*-1;
if (volumesample (2,"surface",@P)<0){
matrix3 m = dihedral(@vel,tempV);
vector newV = lerp(@vel*m,@vel,0);
@vel = newV;
}
else {@density=0;}
//selection par orientation des normales
//red
if (dot(@N,{1,0,0})>ch("x")){
@Cd={1,0,0};
}
if (dot(@N,{-1,0,0})>ch("x")){
@Cd={1,0,0};
}
//green
if (dot(@N,{0,1,0})>ch("y")){
@Cd={0,1,0};
}
if (dot(@N,{0,-1,0})>ch("y")){
@Cd={0,1,0};
}
//blue
if (dot(@N,{0,0,1})>ch("z")){
@Cd={0,0,1};
}
if (dot(@N,{0,0,-1})>ch("z")){
@Cd={0,0,1};
}
//tweakNormal
if (@Cd.x>0.1){
@N= cross(@N,chv("rouge"));
}
else if (@Cd.y>0.1){
@N= cross(@N,chv("vert"));
}
else @N =cross(@N,chv("bleu"));
@N*=ch("normMult");
VEX