ctp,
I’m trying a variation of yours but i can’t seem to get it right! I work with the Z up and thus i’m attempting to modify your code for one with the Z up.
This is the expression that i’m creating:
// sets the orient axis for the instance
particleShape1.aimUp = <<0,0,1>>;
// get surface normal at particle position
vector $particlePos = particleShape1.position;
vector $normal = nearestPointOnMesh -ip ($particlePos.x) ($particlePos.y) ($particlePos.z) -nr -q pPlane1;
// orient the instance
particleShape1.aimDir = $normal;
// random rotation for Z axis
particleShape1.randomRotationZ = rand(360);
//solve each angle, convert to degrees
float $rotX = rad_to_deg( atan2( ($normal.y), ($normal.z) ) );
float $rotY = rad_to_deg( asin( -($normal.x) ) );
// asign random rotation in Z
particleShape1.rotationPP = << $rotX, $rotY, particleShape1.randomRotationZ >>;
any help with this will be greatly appreciated, i’ve attached my file for your reference.
Thanks,
-G