Jump to content
DévinOdforce

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

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

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

  • Like 1

Share this post


Link to post
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

Share this post


Link to post
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

Share this post


Link to post
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

Share this post


Link to post
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

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

×