# Spiral Unrolling / Rolling Animation

## Recommended Posts

Can someone show me how to do the second animation within 3D environment of Houdini?

##### Share on other sites

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

```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);

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.

Example file:

Edited by konstantin magnus
• 1
• 2

##### 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.

• 4
• 4

##### Share on other sites

Thanks, I will try to do this effect to rolls of different number of corners like hexagons etc

##### Share on other sites

simple but elegant as always Matt!

##### Share on other sites

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

##### Share on other sites

Here's my attempt!
Plus bonus Gif!!! Also check my education thread for a curve roller!

Edited by sweetdude09
Forgot to address the curve roll thing :C
• 2

## Create an account

Register a new account