### Rotate Points around a curve

358   2   0
Member
303 posts
Joined: July 2012
Offline
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)

Member
3817 posts
Joined: Feb. 2012
Online
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_ - Nov. 8, 2022 14:40:12
Senior FX TD @ Industrial Light & Magic
Get to the NEXT level in Houdini & VEX with Pragmatic VEX! [www.pragmatic-vfx.com]

patreon.com/animatrix | vimeo.com/animatrix3d
Member
303 posts
Joined: July 2012
Offline
That worked absolutely perfectly! Ill try and dissect what u did and give it a shot. Thanks again!
Edited by Midasssilver - Nov. 8, 2022 14:46:16
• Quick Links