Rotate Points around a curve

   2922   2   0
User Avatar
Member
310 posts
Joined: 7月 2012
オフライン
Hi there, Im struggling with something that should hopefully not be too difficult for someone with more vex knowledge. Ive uploaded a hip of a simple scene, where I have points around a curve. I want the points to orbit around the curve, but maintain their distance. A pop curve force wasn't really working out, and I can't use a pop axis force, so I assumed vex would be the best answer. Any help would be appreciated!

Attachments:
Points_Rot_Around_Curve_01.hiplc (338.5 KB)

User Avatar
Member
5100 posts
Joined: 2月 2012
オンライン
Hi,

If you generate tangent vectors for your curve, you can do something like this:





int primhit = -1;
vector uvhit = 0;

xyzdist ( 1, @P, primhit, uvhit );
vector p = primuv ( 1, "P", primhit, uvhit );
vector t = primuv ( 1, "N", primhit, uvhit );

float r = fit01 ( rand ( @ptnum ), 0.7, 1.5 );
float angle = @Time * ch("speed") * pow ( r, 2 );

matrix3 m = ident ( );
rotate ( m, angle, t );
vector pnew = ( @P - p ) * m + p;

@P = pnew;

EDIT: Added gif.
Edited by animatrix_ - 2022年11月8日 14:40:12
Senior FX TD @ Industrial Light & Magic
Get to the NEXT level in Houdini & VEX with Pragmatic VEX! [www.pragmatic-vfx.com] https://lnk.bio/animatrix [lnk.bio]
User Avatar
Member
310 posts
Joined: 7月 2012
オフライン
That worked absolutely perfectly! Ill try and dissect what u did and give it a shot. Thanks again!
Edited by Midasssilver - 2022年11月8日 14:46:16
  • Quick Links