Jump to content
yesyes

Spiral Unrolling / Rolling Animation

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

Share this post


Link to post
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 3
  • Thanks 4

Share this post


Link to post
Share on other sites

c'mon, Matt, you're soooooooooooooooo close to completing this challenge....could almost reach the finish line now....

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×