Jump to content

Spiral Unrolling / Rolling Animation


yesyes

Recommended Posts

If you know VEX, you can use an attribute wrangle inside a solver. Here is a rough sketch..

Set up a (quadratic) spiral:

float rounds = (@numpt - 1) * 0.5;
float grad = 1 - ( @ptnum / float(@numpt - 1) );
float spiral = (rounds * $PI * grad);
@P.x = cos(spiral);
@P.y = sin(spiral);
@P *= grad;

Unroll the curve inside a solver:

int pt = int( ceil(@Time) );
float amount = ( radians(@Time % 1.0) * $PI * 2.5 );
matrix m = ident();
vector axis = set(0, 0, 1);
vector offset = point(0, "P", pt);
if(@ptnum > pt) {
    @P -= offset;
    rotate(m, amount, axis);
    @P *= m;
    @P += offset;
}

To get the wavy curve, merge it with a trail SOP running on the last point.

Useful links:

http://forums.odforce.net/topic/24056-learning-vex-via-animated-gifs-bees-bombs/

http://www.tokeru.com/cgwiki/index.php?title=The_solver_sop

Example file:

spiral_moving.hipnc

Edited by konstantin magnus
  • Like 1
  • Thanks 2
Link to comment
Share on other sites

I'd looked at this problem a few weeks ago, got 90% the way there looking at some other odforce posts, this inspired me to finish it. :)

The idea is to first calculate the angle between each curve segment, then apply it in a for each loop so each segment is rotated by the total of all the previous segment angles, at the correct pivot point.

curve_unroll.hip

unroll_flipbook.gif.44852a5183b48ad7da02c129c6d4b331.gif

  • Like 4
  • Thanks 4
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...