The logic behind mirrorJoint tool / mirroring



I’m trying to figure out how Maya orients joints with “behavior” option when using mirrorJoint tool.

I thought i figured it out, because with mirroring across “x” and “y” everything works, with “z” there’s something different happens.

So what I’m doing:

  1. get the translation attribute corresponding to the axis we’re mirroring across. (".tx" for mirroring across x axis)
  2. get the rotation values.
  3. set the mirrored transforms translation value to “.tx” * (-1)
  4. set the mirrored transforms rotate axis corresponding to the mirror axis(".rx" in this case) to 180 - abs(".rx") * (-1 if “.rx” was greater than 0 and vice versa )
  5. set the other rotation values to “.ry” * (-1) and “.rz” * (-1)

As I mentioned, this works for x and y fine, but for z, apparently i don’t need to reverse the rotation values for the other channels (5)

I don’t get the logic why in some cases Maya reverses them and in other don’t when using mirrorJoint.

Would appreciate some explanation, pointers in the right direction or maybe texts explaning this stuff.