kiryha Posted January 9, 2019 Share Posted January 9, 2019 I know how to move an object to origin with transform node (with CEX CEY CEZ) but can't get how to restore original position after... moveToOrigin_001.hipnc Quote Link to comment Share on other sites More sharing options...
evanrudefx Posted January 9, 2019 Share Posted January 9, 2019 (edited) I think its better to use centroid rather than CEX. If you use centroid you will actually see values and not just "0". centroid(0,D_X) then you can duplicate the transform node and use the invert transformation button. http://www.sidefx.com/docs/houdini/expressions/centroid.html Edited January 9, 2019 by ejr32123 1 Quote Link to comment Share on other sites More sharing options...
kiryha Posted January 9, 2019 Author Share Posted January 9, 2019 Thanks! Working with a reference copy of the first transform. moveToOrigin_002.hipnc Quote Link to comment Share on other sites More sharing options...
tamagochy Posted January 9, 2019 Share Posted January 9, 2019 just wright position to attribute and after moving to origin apply stored position attribute to @P; 1 Quote Link to comment Share on other sites More sharing options...
kiryha Posted January 16, 2019 Author Share Posted January 16, 2019 Here is move an object to origin with VEX: // Get center of the oject bounding box (centroid) vector min = {0, 0, 0}; vector max = {0, 0, 0}; getpointbbox(0, min, max); vector centroid = (max + min)/2.0; // Build and apply transformation matrix vector translate = centroid; vector rotate = {0,0,0}; vector scale = {1,1,1}; matrix xform = invert(maketransform(0, 0, translate, rotate, scale)); @P *= xform; // Store transformation matrix in attribute 4@xform_matrix = xform; Return to original position: @P *= invert(4@xform_matrix); move_to_origin_001.hipnc 5 1 Quote Link to comment Share on other sites More sharing options...
zinogino Posted September 5, 2019 Share Posted September 5, 2019 On 1/16/2019 at 9:38 PM, kiryha said: Here is move an object to origin with VEX: // Get center of the oject bounding box (centroid) vector min = {0, 0, 0}; vector max = {0, 0, 0}; getpointbbox(0, min, max); vector centroid = (max + min)/2.0; // Build and apply transformation matrix vector translate = centroid; vector rotate = {0,0,0}; vector scale = {1,1,1}; matrix xform = invert(maketransform(0, 0, translate, rotate, scale)); @P *= xform; // Store transformation matrix in attribute 4@xform_matrix = xform; Return to original position: @P *= invert(4@xform_matrix); move_to_origin_001.hipnc Hi, thanks for this and it's wonderful and works for particles. However, it doesn't seem to centroid the rotation as well? 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.