Jump to content
Sign in to follow this  
archz2

Rotating each item on its own individual axis?

Recommended Posts

I have a set of items that I copied over a grid of points. Now in order to rotate each of the item on its own individual axis, I used 'For each connected connected piece' but unfortunately, the entire set of geometry rotates on one single axis. How can I do otherwise?

 

image.thumb.png.1b60556d61e1bd277d8c70b6a8d25431.png

PIVOT ROTATE QUESTION.hip

 

Share this post


Link to post
Share on other sites

You would usually define the point orientation before copying objects to them. The normal vector "N" pointing to the front and the up vector "up" pointing upwards, eg. perpendicular to the surface. Next you can rotate the up vector around the normals using a point wrangle.

float amount = chf('amount');

matrix3 m = ident();
rotate(m, amount * M_PI, v@N);

v@up *= m;

There are many other ways and as per usual Matt's CG wiki has a good read on this: https://www.tokeru.com/cgwiki/index.php?title=JoyOfVex17

rotate_up.hipnc

  • Like 2

Share this post


Link to post
Share on other sites

Thanks a ton. VEX is something that I have learnt the very beginning of (from VEX isn't scary series by NineBetween) and I have to spend more hours in learning and understanding it, and only then your point wrangle will make sense to me. 

Isn't this type of rotation possible by adding some references in the pivot transform or pivot rotate option in the transform node? 

image.thumb.png.66bf013f5a84621847362475235b8ceb.png

Share this post


Link to post
Share on other sites
Posted (edited)

Handling per object-rotations gets easier after packing and instancing the copies. Eg. the primitive node can do random rotations afterwards.

copies_rotate.hipnc

Edited by konstantin magnus
  • Like 1

Share this post


Link to post
Share on other sites

@archz2 create att rot than wrangle

p@orient = eulertoquaternion(radians(v@rot), XFORM_XYZ);

 

  • Like 1

Share this post


Link to post
Share on other sites
On 8/18/2022 at 10:39 PM, konstantin magnus said:

Handling per object-rotations gets easier after packing and instancing the copies. Eg. the primitive node can do random rotations afterwards.

copies_rotate.hipnc

 

Thanks a lot. That did it. Learnt new things now. 'Primitive properties' node and 'Packing and instancing'. Pasting this for myself. This is quite nice. It references the geometries at every location instead of making copies in order to keep the file performance optimized!

https://www.sidefx.com/docs/houdini/copy/packed_and_soups.html

Share this post


Link to post
Share on other sites
16 hours ago, Librarian said:

@archz2 create att rot than wrangle


p@orient = eulertoquaternion(radians(v@rot), XFORM_XYZ);

 

Where exactly do I have to paste this code? What is 'att rot' ?

Share this post


Link to post
Share on other sites
On 8/21/2022 at 6:16 PM, madebygeoff said:

There's a couple good short videos on instance attributes in the documentation for the copy to points sop

https://www.sidefx.com/docs/houdini/nodes/sop/copytopoints

Superb! Thanks a lot @madebygeoff! These are immensely helpful!

 

On 8/21/2022 at 2:00 PM, Librarian said:

maybe useful @archz2

 

bnv.jpg

 

Thank you @Librarian, I'm putting this in my VEX notes to refer later. I didn't quite understand your code magic :). I know very tiny bit of VEX and will be able to understand your file once I learn more of it. 

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
Sign in to follow this  

×