vbk!!! Posted September 6, 2013 Share Posted September 6, 2013 Hello, I would like to convert normal orientation to angle ( rx, ry,rz). The final goal is to take a null and make its rotation value match with the normal orientation of a point. Any help is welcome. Quote Link to comment Share on other sites More sharing options...
old school Posted September 6, 2013 Share Posted September 6, 2013 (edited) You want the dot product between the two vectors which is a float that returns a half cosine (which is how Lambertian shading is calculated from the eye and the surface normal). Convert result with an arccosine to get your angle in radians, then a degrees() to convert from radians to degrees (vex/vops are always in radians). angle_deg = degrees(acos(dot(normalize(vector A), normalize(vector B )) Or just copy-paste the VOP SOP from the attached hip file. Pick up the hip file from the post below. It has both angle float and angle vector examples in there. Edited September 6, 2013 by old school Quote Link to comment Share on other sites More sharing options...
yongbin Posted September 6, 2013 Share Posted September 6, 2013 (edited) hi. To do this, you should set initial N, I assume you will set N to (0,0,1) see file. N_to_angle.hipncFetching info... Edited September 6, 2013 by yongbin 2 Quote Link to comment Share on other sites More sharing options...
old school Posted September 6, 2013 Share Posted September 6, 2013 (edited) If you want the Euler rotation between two vectors, you can use matrix3 dihedral( vector_A, vector_B ). This returns a matrix3 that can be converted to Euler rx, ry and rz. See the attached hip file for a vop implementation and is set up just to copy-paste and change the parameters to match attributes name same as above file. Note that this will flip around 0 and 180. angle_between_two_vectors.hipFetching info... Edited September 6, 2013 by old school 1 Quote Link to comment Share on other sites More sharing options...
vbk!!! Posted September 7, 2013 Author Share Posted September 7, 2013 thanks a lot gentlemen ! Quote Link to comment Share on other sites More sharing options...
frankengen Posted February 26, 2014 Share Posted February 26, 2014 Hello, thanks for this very useful post. I tried doing the same but Im not quite getting there. If I try to attach it to a point, it kind of works but it flips at 360 degrees, upside down momentarily. But if I try to attach say a null to the normal of a rotating cube it goes very wrong. Would appreciate any help. Cheers. angle_between_two_vectors_Problem.hipFetching info... Quote Link to comment Share on other sites More sharing options...
Iraklo Posted March 27, 2017 Share Posted March 27, 2017 Hi Guys, I am wondering how it is possible to do the opposite - convert an angle into a vector? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.