Jump to content

Bi-directional transform


kumpa

Recommended Posts

Isn't that just parenting? Or a point/centroid expression, copy-pasting a parameter, or do I miss something blindingly obvious here?

no, parenting means the childs follow a parent, but in this case it works in both directions

Link to comment
Share on other sites

The Maya constraint only evaluates once the cursor is lifted off one of the objects looking at this video. No way for me to confirm this but if this is the case, fail. This is definitely a feedback type constraint. I don't know how an animator would make sense keying in to this but that is a whole other matter.

Generally you build bi-directional constraints between two end points on a spine and use a kinematics solver to solve the in-between joints.

This is going to be a custom script/asset solution as is the Maya solution. There seems to be quite a few solutions in Maya for bi-directional constraints each with varying levels of success and compromises and most have to do with Spine rigs, not two objects countering each other.

You could create a custom object asset and try using callback scripts to do this. Just pick up the driver_driven object custom tx ty and tz channels then add the difference between the start value and the current value. This should work when you manipulate the parameters but these sort of feed-back callback scripts do NOT currently work with Handles in the viewport.

You could use DOPs in timeless mode to solve the constraint relationship. DOPs does solve on viewport interactions so it should be straightforward to build this with a Script Solver. All the solver is doing is picking up starting positions, recording the movement of the first object and adding it to the second object, whichever one is being moved. Should be very fast.

Link to comment
Share on other sites

The Maya constraint only evaluates once the cursor is lifted off one of the objects looking at this video.

The interface shown in the video suggests they're using the scriptJob MEL command to rewire the constraints on the fly.

Link to comment
Share on other sites

Here is a quick example of doing this for two objects using HOM and node event callbacks. Since you can't edit callback scripts of base parameters on objects you can use the node events to get it done. Using a dummy variable in hou.session to prevent recursion it seems to work pretty well. The only down side in certain situations is that it only detects changes on the whole tuple, not individual components. If you wanted to have say only 'tx' constrained it wouldn't work. The code is generalized to support other parms as well, not just 't'.

import hou

n1 = hou.node('/obj/sphere_object1')
n2 = hou.node('/obj/box_object1')

event_types = (hou.nodeEventType.ParmTupleChanged,)
hou.session.busy = False

def onParmChange(**kwargs):
    if hou.session.busy:
        return

    parm_tuple = kwargs['parm_tuple']

    if parm_tuple is not None:

        tuple_name = parm_tuple.name()
        if tuple_name in ('t',):

            hou.session.busy = True

            node = parm_tuple.node()

            if node == n1:
                n2.parmTuple(tuple_name).set(parm_tuple.eval())

            if node == n2:
                n1.parmTuple(tuple_name).set(parm_tuple.eval())

            hou.session.busy = False


n1.addEventCallback(event_types, onParmChange)
n2.addEventCallback(event_types, onParmChange)

Edited by graham
Link to comment
Share on other sites

Thank you everyone for your answers, what I am aiming for is to mimic MotionBuilder default character rig where you can create any number of "auxilary affectors", grab any of them and rotate whole limb around it and the rest would follow.

Edited by kumpa
Link to comment
Share on other sites

I don't know in which version of Houdini this actually happened, but for some time now simple channel references are bi-directional in Houdini.

wtf, weird :)

it works even with expressions, like: ch("../null1/ty")+sin($FF*3)*3

Edited by sanostol
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...