Floating plane to center/origin, then back to original pos

   3428   4   2
User Avatar
Member
2 posts
Joined: Oct. 2014
Offline
Good day,
I'm sorry to bother anyone. My problem is probably really simple to fix, and the solution is probably staring me in the face, but I just can't see it.

Basically what I want is to move an object from the world location it was generated back to the origin, scale it there, and then move it back to the original position.

I easily managed to move it to the origin and scale it (-$CEX(Y,Z) to get to the origin), but I am completely stuck on how to get it back to the original position.

I've seen someone do this, but I can't remember who or how…

Any help would greatly be appreciated~
User Avatar
Member
443 posts
Joined: Sept. 2012
Offline
Use centroid() expression function.
User Avatar
Member
443 posts
Joined: Sept. 2012
Offline
Transform sop:

Translate:
tx:
centroid(“../actual_node_with_world_location”, D_X)
ty:
centroid(“../actual_node_with_world_location”, D_Y)
tz:
centroid(“../actual_node_with_world_location”, D_Z)
User Avatar
Member
2 posts
Joined: Oct. 2014
Offline
thank you very much~
User Avatar
Staff
2540 posts
Joined: July 2005
Offline
Two ways to do this interactively without resorting to expressions.

The first method is to parent a child to your object and should do exactly what you want. Steps:
- put a null in your network,
- make sure that “Keep Position When Parenting” is off
- wire the input of the null to the output of your object that needs.
It will snap to your parent object's origin pivot
- Turn on “Keep Position When Parenting” on your null.
- unwire the null's input.
Now this will “hold” your current position
- Now do whatever to your object to correct the situation at the origin.
- When complete, make sure that “Keep Position When Parenting” is off on your Object.
- wire the input of your object to the Null you placed above.
This will re-set your object to it's original position.
- Enable “Keep Position When Parenting” on your Object
- Unwire the object from the null and you are back where you started.

Notes on this first method:
- If you really want to, there is no need to move the object to the origin when you parent this Object to the null after capturing the original object location and you unwire the null. In effect, the object is at a local origin but simply parented to the null. It's parameters should be set to 0,0,0. Even if it has inherited a pre-transform.

- It is quite common to re-work and object or Null when it is inside a deeply nested hierarchy. The above method works well as the net added Null behaves as a place-holder in the network as you do your work. Or you can literally break your hierarchy if you make sure that the child of your object has “Keep Position When Parenting” enabled and simply unwire your object.


Second method involves using pre-transforms and modifying the object in place with it's parameters zero'ed out.
Note that for this step to work, in the Preferences > Objects and SOPs > Read Only Pretransforms needs to be off. The default is off but if you are working in a large facility with old crusty Houdini users that muck with preferences (like me who turn this off because I am a control freak wrt pretransforms), you never know…
- On the object parameters, press and hold on the Pre-Transform menu button and select “Clean Transform”.
All your parameters will be set to zero and the object doesn't move as the transform has been written to the object's “pre-transform” internal parameters. You can view this pre-transform if you MMB (MiddleMouseButton) on the node's icon.
- Do whatever you need to do to your object wrt any transforms.
- When complete, press and hold on the Pre-Transform and choose the Extract Pretransform option to apply to the base parameters.

There are a bunch of other ways to manipulate objets with transforms in hierarchies as well.
There's at least one school like the old school!
  • Quick Links