Jump to content

vector convert to xyz degree to rotate object


katosa

Recommended Posts

hello

I would like to ask about if i can use vector to make object rotate.

here is the scene I am working on.

I get vector from point 0 and 1.

and want to use that to rotate tube along 0-1 line.

I am not strong at math. and I want to know  which function I should use to change vector to xyz degree. 

thank you for reading.

pipe_generate_v02.hipnc

vector to rotate object.PNG

vector to rotate object_get degree.PNG

vector to rotate object_get degree2.PNG

Edited by katosa
Link to comment
Share on other sites

Hi,

You can use the dihedral function:

vector p0 = point ( 1, "P", 0 );
vector p1 = point ( 1, "P", 1 );

@orient = dihedral ( { 0, 1, 0 }, normalize ( p1 - p0 ) );

Position wise it's up to you if you want the tube to sit on point 0 or point 1, be centered to the line, or just rotate.

  • Like 1
Link to comment
Share on other sites

9 hours ago, katosa said:

thanksfully I could rotate tube. 

still wish to know if vector xyz can be converted to xyz rotation degrees so that I can use in parameters in transform node.

vector to rotate object_get degree4.PNG

Yes, you can convert @orient with the quaterniontoeuler() function, which will give you the rotation values in radians. You can then convert them to degrees with the degrees() function.

  • Like 1
Link to comment
Share on other sites

7 hours ago, dleonhardt said:

Yes, you can convert @orient with the quaterniontoeuler() function, which will give you the rotation values in radians. You can then convert them to degrees with the degrees() function.

thank you very much. I could get the degrees. 

quaterniontoeuler_vex.PNG

quaterniontoeuler.PNG

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

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

×
×
  • Create New...