I am trying to rotate packed geometry individually. But can find a way to make it.
I have geometries (the flags) that I first copy and orient to a cube. Then I want to randomly rotate the flag individually around their “mat” axis.
I was able to get a transform matrice for each prim of the cube but then I am stuck.
Not sure if I should transform the matrice before or after the copyToPoints Node, plus I can't find a way to rotate the flags individually around their “mat”.
Any help will be very appreciated thanks.
//get X Y Z Vector per prim int primpts[] = primpoints(0,@primnum); //get prim edge int edgeA = primhedge(0, @primnum); int edgeB = hedge_next(0, edgeA); //get prim edge points id int edgeA_p1 = hedge_srcpoint(0, edgeA); int edgeA_p2 = hedge_dstpoint(0, edgeA); int edgeB_p1 = hedge_srcpoint(0, edgeB); int edgeB_p2 = hedge_dstpoint(0, edgeB); //get prim edge points poistion vector a1 = point(0, "P", edgeA_p1); vector a2 = point(0, "P", edgeA_p2); vector b1 = point(0, "P", edgeB_p1); vector b2 = point(0, "P", edgeB_p2); vector x = normalize(a2-a1); vector t = normalize(b2-b1); vector y = cross(x, t); vector z = cross(x, y); v@vX = x; v@vY = y; v@vZ = z; /* vector center = getbbox_center(0); matrix m = set(x,y,z, center); setcomp(m, 0, 0, 3); setcomp(m, 0, 1, 3); setcomp(m, 0, 2, 3); 4@xform = m; */
v@N = set(v@vZ[0], v@vZ[1], v@vZ[2]);
float t = chf("t"); // matrix to transform by matrix tf = ident(); rotate(tf, radians(t), {0,1,0}); //rotate(tf, radians(t), @N); // prim existing matrice matrix transform = getpackedtransform(0, @primnum); setpackedtransform(0, @primnum, transform * tf);


