Maya - matrix constrain joints to mirrored ctrls - ctrls are in scaleX = -1 space

Hi there, first post here :slight_smile:

in short:

  • joints are mirrored with mirror joints tool (behaviour) and oriented with Z as main axis
  • I duplicate my left ctrls
  • mirror them by putting them in a group and scaling it in x = -1
  • when I do a matrix nodes connection into the joint, the joint seems to have the wrong orientation

The node connection setup is based on this Jarred Love tutorial:

I tried it as well without the decomposeMatrix and instead plugging directly into the offset parent matrix, but that pops the joint back to the left side and then the rotation pivot is totally wrong. it seems like ctrls being in a -1 scaleX space is making it impossible to connect an R_ctrl to an R_jnt.

Is there a way to make this work?

Also am I wasting time by looking into matrix connections as an alternative to constraints? I just like how clean the node editor looks and no extra nodes in outliner, but is that not worth the trouble?

Cheers

You never want negative scale values on your controls (or…anything, for that matter. I can’t think of a single reason you’d want negative scale) They should always be uniformly 1.

You’ve got the right idea with transferring/mirroring. Have you tried mirroring the joint, duplicating the control, and then match transformation to the mirrored joint?

I can give you one reason why I’m doing it: mirrored behaviour on Rotation AND Translation. The only way I know to get that is the scaleX = -1 approach.

Is there another way to get that to work?

Also is there a way to be selective about which axes are mirrored? E.g. Ik Foot Ctrl should be mirrored but not on Tx, how would you get that?

And yes I tried matching transf to joint, but then I can only pick rotation or translation to be mirrored, not both :frowning: I guess due to how the mirror joints tool in maya works.

If I mirror joints over with scaleX = -1 then maya adds a transform node above those joints to enable the mirroring. Not pretty.

This might go without saying, but just in case:
I think typically the -1X scale would applied not to the control itself, but to a control object’s parent group / null / hierarchy buffer; or applied at some higher level in the hierarchy (like the shoulder or clavicle, to include the child spaces for an arm, for example)

In other words the -X scale is applied to the space of the control and not the control itself. This allows mirrored rotation behavior while leaving the actual control’s channels “zeroed out”

yes that’s exactly what I’m doing. Not scaling the ctrl but instead a parent group to mirror it over, or I’ve been trying to use the offset parent matrix for that too. So that the ctrl is all zeroed out :+1:t4:

Ok, so full disclosure I don’t remember the math on this, and it may only work for certain orientation, I don’t know, but I had a look at how I’m mirroring matrices and I’m taking each axis vector, and multiplying it by (1, -1,-1). Give that a try?

I got a suggestion by Jarred Love on his video’s comments which is probably similar to yours @Morganism :

When I scale the offsetGroup of the Ctrl by x= -1 it inverts the right handed matrix into a left handed matrix. So if I would include a left handed matrix in the multMatrix calculation it should put it in the correct matrix space.

Sure enough adding a fourbyfour matrix with the first number instead of a 1 a -1 plugged into the first input. i.e.:

  1. left handed matrix
  2. ctrl’s worldMatrix[0]
  3. joint’s parent’s worldInverseMatrix[0]
    into a multMatrix

then plugging the output into the offsetParentMatrix of the joint results in mirrored behaviour on all rotation and translation axes. Great stuff! q.e.d.

Weirdly enough though when I use a decomposeMatrix to connect into the transform channels of the joint like a constraint, the result mirrores all axes except rotation Y & Z. Shouldn’t those results be the same?

Now I just have to figure out how that gels with offsets and jointOrients :grimacing:

1 Like