Move pivot to geo/geo to pivot or worl center

   29835   12   2
User Avatar
Member
184 posts
Joined: March 2015
Offline
Hey,



a simple question here: how can I move an object to the pivot or a pivot to the center of an object; or an object to the center of the world? Got a case where the ship as well as the pivot are off. I need them both at the same place on object level.

Attachments:
off.png (946.0 KB)

User Avatar
Member
26 posts
Joined: June 2016
Offline
To reset the pivot to the center of the object:

Go inside the object (geo level) and put down a transform. On the transform properties, there is a 'Move Centroid to Origin“ Button.

To modify the pivot in general, when in object level press the ”Insert" Button on your keyboard. This will allow you to move the pivot. Can be combined with snap to point to move it to specific points on your object.
User Avatar
Member
184 posts
Joined: March 2015
Offline
I know I can manually move the pivot in object lebel. But isn't there a more precise, automated process? Depending on the kind of geo this move and snap method isn't the finest.
User Avatar
Member
670 posts
Joined: Sept. 2013
Offline
-$CEX -$CEY -$CEZ
in transform node's translate field will put your object automatically back to the world's center.

-$CEX -$YMIN -$CEZ
for putting it right on the floor.
https://procegen.konstantinmagnus.de/ [procegen.konstantinmagnus.de]
User Avatar
Member
184 posts
Joined: March 2015
Offline
Know that expression too but isn't $CEX/Y/Z just moving the pivot, not the object itself? So wherever the object is..with that expressions the pivot will adjust to that position.
User Avatar
Member
670 posts
Joined: Sept. 2013
Offline
Maybe I got you wrong, but in transform node it should be:

Rosko Ron
how can I move an object to the pivot
Translate: -$CEX -$CEY -$CEZ
Pivot: $CEX $CEY $CEZ

Rosko Ron
or a pivot to the center of an object
Just Pivot: $CEX $CEY $CEZ
https://procegen.konstantinmagnus.de/ [procegen.konstantinmagnus.de]
User Avatar
Member
1755 posts
Joined: March 2014
Offline
A “normal” workflow - as in a few clicks and no expression shenanigans - would be to use a button “move centroid to COG (center of geometry)” and then use another feature which allows you to input a value a single time for all axis of a transformation - zero for translation at OBJ level in your case. I can do what you need here in three seconds flat in another program…

Both of these features (move centroid to COG, input once for all three axis) have been RFEed by yours truly as part of the “little things that would improve Houdini viewport interaction by a tenfold” campaign.
You might wanna start filing RFEs for these as well or they'll collect dust on a virtual shelf somewhere in SESI's virtual RFE basement.
Edited by anon_user_89151269 - April 24, 2017 10:15:31
User Avatar
Member
323 posts
Joined: Jan. 2015
Offline
Hi McNistor,
normal as in not procedural? This is Houdini with full procedural shenanigans for even the smallest thing.
But i agree in so far as a few more ready made HDAs would be useful especially for people who dont like expression shenanigans.

And: you also have orbolt: https://orbolt.com/asset/animatrix::centroidalPoints::1.00 [orbolt.com]

I would love a node that put the pivot to the COG (center of gravity), center of bounding box i can wire up myself.

Center(Centroid) of geometry is not the same as center of bounding box.
Its actually not that trivial: http://wwwf.imperial.ac.uk/~rn/centroid.pdf [wwwf.imperial.ac.uk]

Maybe one of the math wizards here could do it… I cant even read it…

kind regards

Olaf

Attachments:
centerofpolygon.JPG (56.3 KB)

User Avatar
Member
1755 posts
Joined: March 2014
Offline
Hi Olaf,
No, “normal” as in a few clicks as I said earlier, # of clicks being inconsequential as far as proceduralism goes. I like expressions and the option to use them whenever it's necessary, but there are times, and I feel this is one of them, when I'd rather take a few secs hitting a button or two instead of much more for writing expressions for simple modeling tasks such as these.
Houdini's very generous regarding the first option but severely lacking in the latter.
Should one ever hope to see artists in the non-VFX modeling/concept art business using Houdini, one would do good to accept the need of such workflows in H.

p.s. THose summations seem rather simple. It would be more interesting to see how you end up with those. Hell, I'll look into it when I had enough Zbrush for a certain day.
Edited by anon_user_89151269 - April 24, 2017 11:22:18
User Avatar
Member
4189 posts
Joined: June 2012
Offline
Check out Sop_Example_Computebarycenter in the docs.

@Olaf the only question there is why is 6 times the area used!
User Avatar
Member
182 posts
Joined: April 2009
Offline
There is a button on the “Modify” Shelf called Center Pivot
User Avatar
Member
182 posts
Joined: April 2009
Offline
To center it to world you simply need to transform along the reversed pivot location.
To make things easier you can reuse the Center Pivot shelf tool and add 2 lines to it.

Create a new shelf tool:

import toolutils
 
scene_viewer = None
activepane = toolutils.activePane(kwargs)
parent = activepane.pwd()
if activepane.type() != hou.paneTabType.SceneViewer:
    # Use the last selected object
    if parent.childTypeCategory() != hou.objNodeTypeCategory():
        raise hou.Error("This tool cannot be executed in this context")
    selected = [child for child in parent.children() if child.isSelected()]
else:
    scene_viewer = toolutils.sceneViewer()
    selected = scene_viewer.selectObjects(
                prompt = toolutils.selectionPrompt(hou.objNodeTypeCategory()),
                allow_multisel = True,
                allowed_types = ("geo",))
 
if len(selected) == 0:
    raise hou.Error("Nothing was selected")
 
for center_obj in selected:
    display = center_obj.displayNode()
    if display is None:
        pivot = hou.Vector3(0, 0, 0)        # Use 0,0,0 by convention
    else:
        geo = display.geometry()
        pivot = geo.boundingBox().center()
    center_obj.parmTuple("p").set(pivot)
    if kwargs['ctrlclick']:
        center_obj.parmTuple("t").set(-pivot)
 
if scene_viewer is not None:
    scene_viewer.setCurrentState("objxform")

I only added this:
if kwargs['ctrlclick']:
center_obj.parmTuple("t").set(-pivot)


Now when you click the tool it centers the pivot like before, but when you CTRL click it it also moves the object to the center of the world.
Edited by blackpixel - April 25, 2017 04:20:43
User Avatar
Member
1755 posts
Joined: March 2014
Offline
Thanks Mariusz.
I'm still debating in my mind while also trying to figure if there are any downsides regarding Houdini's way of dealing with these things - in this case using a “pivot value”. Transformations in Houdini are dealt a bit… different than I'm used to and in some cases worse, from a manipulation PoV.
  • Quick Links