Jump to content

Move pivot to center of other node?


Recommended Posts

Hi! 

I wonder if u could help me with something.

I want my two Transforms called 'rotate' and 'rotate1' to have as the pivot for rotation the center of the two together. The center of the node called 'Transform_all', for that matter. 

I tried putting $CE* in the Transform_all node, and paste relative references to the other 'rotate' nodes, but that makes everything disappear. 

Any ideas?

 

MovePivotToCenterOtherNode.hip

Link to comment
Share on other sites

One idea that comes to mind is merging and then packing those two boxes you have, and adding a single point to it while deleting the geometry. This will give you the center of whatever geometry you have. Then, do whichever of various way you want to blend positions and rotations between the two.

Link to comment
Share on other sites

On 3/13/2019 at 7:30 AM, bunker said:

try the "centroid" expression instead:
centroid("../mynode",D_X),centroid("../mynode",D_Y),centroid("../mynode",D_Z)

Thanks. The centroid function works on sphere1.. But not on my Transform_All? Do you know what is going on?

MovePivotToCenterOtherNode2-2.hipnc

5c8a8165af823_Screenshot2019-03-14at17_27_38.png.d01b8796ac4aa040f4051f3947472008.png

Edited by DévinOdforce
Link to comment
Share on other sites

Looks like a dependency loop. In the 'rotate' xform node you're referencing the centroid of 'transformall' - which is downstream.

edit:

Looking at your original file, $CEX $CEY $CEZ in the pivot translate of 'transformall' seems to work fine for giving you a pivot between the two boxes. They only seem to evaluate to 0 using the old dollar sign variable syntax. Use the following expressions in the pivot translate of 'transformall' to get the equivalent in hscript which evaluates correctly. Then use the 'transformall' rotation controls to rotate the two boxes together.

centroid(opinputpath(".",  0), D_X)
centroid(opinputpath(".",  0), D_Y)
centroid(opinputpath(".",  0), D_Z)

 

Edited by markingleukc
Link to comment
Share on other sites

2 hours ago, markingleukc said:

Looking at your original file, $CEX $CEY $CEZ in the pivot translate of 'transformall' seems to work fine for giving you a pivot between the two boxes. They only seem to evaluate to 0 using the old dollar sign variable syntax. Use the following expressions in the pivot translate of 'transformall' to get the equivalent in hscript which evaluates correctly. Then use the 'transformall' rotation controls to rotate the two boxes together.

So you can't use something that is downstream with centroid()?

I don't want to rotate them together in the transformall. I want to rotate them independently with the center of transformall as pivot.

Edited by DévinOdforce
Link to comment
Share on other sites

Ah okay, then I would use expressions such as below to calculate that point without having to do a merge. Add these to the pivot translate of the 'rotate' xform node. And vice versa for 'rotate1', just edit the path of the second centroid function.

(centroid(opinputpath(".",  0), D_X) + centroid("../rotate1/", D_X)) / 2
(centroid(opinputpath(".",  0), D_Y) + centroid("../rotate1/", D_Y)) / 2
(centroid(opinputpath(".",  0), D_Z) + centroid("../rotate1/", D_Z)) / 2
  • Like 1
  • Thanks 1
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...