Jump to content
Halltom92

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


Link to 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);
}

 

houdini_2017-12-21_10-08-53.png

odforce_test_001_FIX.hip

Edited by Sepu
  • Like 1

Share this post


Link to post
Share on other sites

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
  • Like 1

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

×