# 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 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
##### Share on other sites

That's perfect. Thanks for your help.

Merry Christmas

##### Share on other sites

• 2 weeks later...

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

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

@orient = quaternion(mat);```

Edited by Parboil

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

×   Pasted as rich text.   Paste as plain text instead

Only 75 emoji are allowed.

×   Your previous content has been restored.   Clear editor

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

×
×

• #### Support

×
• Create New...