I have a problem when modifying the transformation of packed primitives after they are created and placed (I use a “copytopoints” set to “Pack and Instance” to place one at the midpoint of each curve segment)
After a while I figured out how to rotate and scale them afterwards using their intrinsic transformation matrix. Unfortunately, it doesn’t work in every case, some instances get the wrong transformations and I can’t figure out why:
This is my code:
#include <math.h> //read transformation from spare parameters vector t, r,s; t = chv('translate'); r = chv('rotate'); s = chv('scale'); //get intrinsic transforms from packed primitives matrix3 transformIntrinsic = primintrinsic(0, "transform", @primnum); //extract orientation vector for each point to use as pivot rotation vector orientvector = cracktransform(XFORM_TRS, XFORM_XYZ, 1, @P, transformIntrinsic); //create transformation matrix matrix m = maketransform( XFORM_SRT, XFORM_XYZ, t, r, s, @P, orientvector); //multiply with transformation matrix and set as new ntrinsic transforms transformIntrinsic *= matrix3(m); setprimintrinsic(0, "transform", @primnum, transformIntrinsic);
(using packedtransform() to apply the transformation works too, but doesn’t make any difference)
I thought the reason could be the polyframe node that I’m using to get the initial placing, since I noticed that in some cases it generates wrong (or no) values, but the result directly after the copytopoints node are correct.
(Actually, I could work around this by modifying the values before instancing them, which can be tested with the switch node in the example file, but I’d rather do it the other way)
Any ideas why it doesn’t work the same for every packed prim?
(I attached my test scene)


