How to copy a bone's visual transforms to another with a Child Of constraint?

Here are the rest positions of three bones. The upper left one has a Child Of constraint with the lower bone as the target.
image

Here are the bones offset from their original positions.
image

If you copy the transforms of the right bone to the left bone with Child Of disabled, it works as expected.
image

But with Child Of enabled, it is offset according to the lower target bone’s transform.
image

Is there a way to copy the right bone’s visual transforms to the left bone while Child Of is enabled, through a series of operations or scripting?

Couldn’t you use a Copy Transforms constraint instead, which allows you to select the source and target spaces (object vs world etc)

I’m not sure how to use Copy Transforms in a similar way to Child Of, especially with Set Inverse which is extremely helpful for when a character picks up an object for example; the bones are constrained to each other based on their pose positions at the time and not their rest positions.

You have child-of, then copy transforms, and you want the transform that, when modified by the child-of, provides the copied transforms?

Blender can’t do that natively. It’s not impossible to do in this case, so a script or addon somewhere might do it. It is impossible to do in the general sense of any two constraints-- sometimes there are no solutions, sometimes there are multiple solutions.

It would help to know the actual, real world problem you’re trying to solve here. For example, one way to get what you want is to mute the child-of, then turn the copy location into a visual transform, then unmute the child of and set the inverse. Of course, that loses your existing inverse, but if you need the old inverse, make a new child-of and alternate between the two.

That does what you want, but it would be unnwieldy if it mean you needed a new child-of every frame. But then, it’s not clear why you want to do this.

1 Like

That’s what I’m looking for, yes, to get the transform A that will allow the bone being modified by child-of to visually copy the transform B.

I think of it as applying the “opposite” of the transform done by the child-of, so I tried to write a script that uses the child-of bone’s transform, the parent bone’s transform, and the child-of constraint’s inverse matrix in some way to achieve that, but matrices are still too much for me to fully understand as of now.

As for why I want to do this:

Slightly shorter version: I animate using the original bone and a duplicate bone, with the duplicate having the child-of and the original having a copy-transforms with the duplicate as the subtarget. When I need child-of, I animate the copy-transforms influence from 0.0 to 1.0, of which the resulting bone movement becomes smoother the more closely the duplicate follows the original before this stage. Since the default snapping and copying tools Blender has doesn’t work too well for bones offset by child-of, I have to manually move the duplicate to copy the original, unless there’s a way to automatically get the transform A for the child-of bone that visually copies transform B.

Long version:
I usually use child-ofs by duplicating the original bone (say “hand.L”), adding the child-of constraint to the duplicate (renamed “hand.CHILD.L”), and adding a copy-transforms constraint to the original with the duplicate as the target. I do this because adding the child-of directly to hand.L and animating its influence usually causes the movement not to be smooth, while a copy-transforms to hand.CHILD.L is smoother.
Here’s a vid to illustrate the setup: The original is purple and the duplicate is cyan, and the duplicate’s child-of target is the shoulder. The upper right shows the influence of copy-transforms.

(There are other reasons why I prefer this method a lot more, such as that I don’t have to create extra child-ofs with different inverses every time the hand is placed somewhere else, and the animation curves are usually easier to manage.)

While it’s smoother to do it this way, the movement around the period where hand.L’s copy-transforms influence slides from 0.0 to 1.0 is sometimes still not as smooth as I’d like it, especially if hand.L and hand.CHILD.L are far apart.
So to fix this, I usually try to animate hand.CHILD.L to follow hand.L as closely as possible before the copy-transforms starts to kick in, which can be tedious to do.
And so finally, that’s the reason why I want a way to get transform A that visually copies transform B after child-of modification. It will be much easier to make hand.CHILD.L copy hand.L during that pre-copy-transforms stage.

Yes, I understand using an extra layer, so you can get copy transforms interpolation instead of child-of interpolation.

And then, you want to be able to snap hand.CHILD.L to hand.L, although I’m surprised that eyeballing it isn’t good enough.

One way to do this is to add one more layer: duplicate hand.CHILD.L, then parent the new duplicate to the original, and set your copy transforms to copy from your new duplicate. In this case, hand.CHILD.L never gets any keyframes, it just gets the child-of transforms, which its new child inherits via regular old parenting-- and so the world transform of its new child is unconstrained, ready for a visual transform.

While this is scriptable, I’ve never done any of that, and I wouldn’t trust my own math without testing it out.

Note that you’re creating a dependency loop no matter how you do it-- that child-of is still creating a dependency, even when it’s muted or the influence is 0.0-- and Blender is going to choke on that loop unless you go out of your way to prevent it (like bake action->create and delete constraints->bake action.) These kinds of loops seem okay for a single thing, like make a constraint, visual transform, delete the constraint, without ever posing the other bone in-between, but they wouldn’t be okay for anything that involved frame changes.