How could you adjust rotation points before Copy to Points SOP?
I'm copying objects to points from popnet and I want to rotate the points to randomize a little their tilt. I could do it with vex after the copying but I belive it would require me to unpack those, and these are pretty heavy so I want to avoid that.
Here is the example scene. Red is popnet sim movement and I want to randomize the rotation along the green axis so that it still faces the red axis.
Copy to points orients objects using normal and up vector. Or vector4 "orient". Try normal and up vector. @up = {0,1,0}, And @N probably in your case will be equal to normalized @v.
Easy way is MOPs Randomize [github.com], you can specify Euler ranges for each local axis of rotation.
Otherwise you just need to create a random axis/angle rotation using a bit of VEX and apply that to the orientation:
vectoraxis = {0,0,1}; // this is the "forward" axis for a copyfloatamount = fit01(rand(@ptnum), -180, 180); // random amount to rotate around xvector4r = quaternion(radians(amount), axis);
// multiply existing orientation with this random rotation in local spacep@orient = qmultiply(p@orient, r);
This assumes your particles already have an orientation. If they don't, consider using a POP Lookat DOP to aim your particles towards the velocity vector in the simulation, or some other method to create the orientation that looks in the direction of movement.
toadstorm Easy way is MOPs Randomize [github.com], you can specify Euler ranges for each local axis of rotation.
Otherwise you just need to create a random axis/angle rotation using a bit of VEX and apply that to the orientation:
vectoraxis = {0,0,1}; // this is the "forward" axis for a copyfloatamount = fit01(rand(@ptnum), -180, 180); // random amount to rotate around xvector4r = quaternion(radians(amount), axis);
// multiply existing orientation with this random rotation in local spacep@orient = qmultiply(p@orient, r);
This assumes your particles already have an orientation. If they don't, consider using a POP Lookat DOP to aim your particles towards the velocity vector in the simulation, or some other method to create the orientation that looks in the direction of movement.
Thanks!! That's what I wanted to accomplish. Seems that I was lacking the POP Lookat DOP.
Reman vector axis = {0,0,1}; // this is the "forward" axis for a copy float amount = fit01(rand(@ptnum), -180, 180); // random amount to rotate around x vector4 r = quaternion(radians(amount), axis);
// multiply existing orientation with this random rotation in local space p@orient = qmultiply(p@orient, r);
This is what I've tried and I doesn't give me the result I need.