Jump to content

Simple angle to point orient


jonathantopf

Recommended Posts

Hi there, I'm a new huodini user learning on the job after years using maya and this is my first odforce post after much reading.

 

I'm writing a very simple point wrangle node and the last step of the program involves turning a 0-1 rotation value representig a 360 rotation value in the Y axis into a per point orient value that a copy sop can then use to istantiate geometry with the correct orientation.

 

My problem is in converting these values, my first attempt was this

f@pi = 3.14159; 
@orient = set( 0, (2 * @pi) * @y_rot, 0  );

I do get an orient value in the correct axis but not what i was expecting and is clearly wrong.

 

Can anybody shed some light on how to construct a simple @orient value from a simple xyz rotation

 

Thanks!

Link to comment
Share on other sites

I believe orient is a vector pointing to a direction, not an array of Euler rotational values...

I could be wrong though! :)
Try this code:
 

float y_rot = 0;
y_rot = radians(random(@ptnum)*360);
vector axis = set(0, 1, 0);
vector4 Q = quaternion(y_rot, axis);
p@rot = set(Q);

rotation_and_copy.hip

Edited by rafaelfs
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...