newbie rotation question

   3228   7   1
User Avatar
Member
17 posts
Joined: July 2012
Offline
Hello,

If I have some geometry, say a box, which is at a random rotation and position, how do I return that box to the origin with rotation of 0,0,0?

Thanks!
User Avatar
Member
184 posts
Joined: June 2010
Offline
Assuming your box is inside a geometry context (I.e. obj/box/), you'd use a Transform SOP node.

If you haven't already, I'd suggest playing through the First Steps tutorials as they'll save you a lot of question marks

Edit: Looking at your previous posts you seem to have covered a lot of ground already..maybe I misunderstood your question?
Edited by - Sept. 9, 2013 17:12:12
User Avatar
Member
17 posts
Joined: July 2012
Offline
Oh yes sorry, I mean I want to be able to calculate the rotation vector and negate it. I.e. reset the rotation procedurally.
User Avatar
Member
184 posts
Joined: June 2010
Offline
edit: ah, scratch that. I thought it was simple, but apparently not…

I guess it's going to depend on how your geometry's been moved. If it's through transforms, you can just add them up in an xform with references, and enable Invert Transformation.
Edited by - Sept. 9, 2013 17:40:48

Attachments:
invert_transform.hipnc (50.9 KB)

User Avatar
Member
17 posts
Joined: July 2012
Offline
Sorry, not explaining very well I guess!

I want to be able to calculate the rotation without knowing the the current rotation values. For example if I file in a cube which is rotated to some random rotation on x, y and z, but I don't have access to these values, so I need to calculate them somehow.
User Avatar
Member
184 posts
Joined: June 2010
Offline
Yeah slightly trickier… How is the geo being transformed randomly? If it's through an expression or script you could pass the transform history into vector attributes, and use that to get your inverse transform later on.

The only other way I can think of off the top of my head is to group a couple of points (or 3) early on, and use those as a reference to restore the position and orientation - I'd do this in Python, I should think it can be done easily in VOPs too. Maybe store just 1 point's xyz and normal as a transform stamp…too late to experiment now though.
User Avatar
Member
122 posts
Joined: Aug. 2013
Offline
just one box?.
one columns one normal. One point to tranf the normal made before,with blendsop, blend normal. i dont know. am drunk.
cheeehee hee
User Avatar
Member
184 posts
Joined: June 2010
Offline
Indeed. Shame on my own late night shenanigans and brain farts: you want the Align SOP ops:

(Feed in the geometry to match, and disable Individual Alignment)
  • Quick Links