Jump to content

Resetting Object Rotations at Origin Based on Attributes (SOLVED)


Recommended Posts

Hello all,

I am sending some geometry pieces back to the origin to do some manipulation.  Im using a for loop, and within the loop  Ive at least managed to move each piece back to the center.  The issue is rotation.  I want the objects existing normals "N" to be flush with the x axis while working, and the objects 'up' vector to be flush with Y axis {0,1,0}.  I know I can use the arccos(dot(up, up2) function  to get the angle I need, (and have done so), my issue is I cant figure out how to rotate the pieces accordingly.     

 

 

 

So basically--object incorrectly rotated at center-- its existing Normals should face towards +x {1,0,0}, and its "up" vector should face towards {0,1,0}.    

 

After work is done, Id like to be able to send the piece back to where it came from, but am a bit stuck.  

 

Thanks for the help!!!

 

 

 

 

 

 

rotation_reset_at_origin.hipnc

Edited by JKeil
Link to comment
Share on other sites

7 hours ago, anim said:

you don't need loop at all, just promote your attribs to get average values per prim to each point

compute transform attribute and invert transform

then use Transform By Attribute SOP to transform back and forth as you need, see the file

 

rotation_reset_at_origin_fix.hipnc

Thanks Tomas!-- a much more straightforward method than I was conjuring up.  

Solved!

 

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...