Jump to content

# copy to points rotation

## Recommended Posts

Hi,

I'm currently trying to assemble a chain, driven by a guide curve. Using the copy to points node, I'm trying to figure out how to rotate every other copy by 90 degrees. I can only seem to control the orientation using N, which is set to the tangent of the guide curve. I'm sure I'm able to do this using the orient attribute, but I'm not completely sure how to.

Any help would be gratefully received.

Thanks

odforce_test_001.hip

#### Share this post

##### Share on other sites

One way to do it, will be using an @up vector and a cross product between the current up and N from the polyframe. Use the module function to rotate every other chain.

```v@up = {0,1,0};

if(@ptnum % 2 == 1){
@up = cross(@up, @N);
}```

Edited by Sepu
• 1

#### Share this post

##### Share on other sites

That's perfect. Thanks for your help.

Merry Christmas

#### Share this post

##### Share on other sites
Posted (edited)

Recreated the chain rotation setup a slightly different way. Using 45 degree interval rotations and there is a global rotation offset.

```vector temp_up = set(0, 1, 0);

@N = normalize(@N);
@up = cross(temp_up, @N);
v@binormal = cross(@N, @up);

setattribtypeinfo(0, "point", "binormal", "point");

matrix3 mat = set(@N, @binormal, @up);

float rot = radians(chf("rotate"));

rot += 45 * @ptnum;
rotate(mat, rot, @N);

@orient = quaternion(mat);```

Edited by Parboil
• 1

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

×
• Donations

• Leaderboard