Home Website Youtube GitHub

Mirroring issue with control_01 and EPIC_control_01

Hello !
I would like to report an issue i’m facing with orientation of EPIC_control_01 and control_01 guide.

When mirrorring an EPIC_Shoulder_01 for exemple, joints are properly mirrored because X is aiming at opposite direction from the other side. That’s the usual mirror that we use in every rig.

But that’s not the case for EPIC_control_01 and Control_01.
The solution I found is to use PRE scripts that updates the orientation of the guides before building them (add 180° in Y local rotation).
But it needs some manual operations that could be avoided, I guess.
Maybe a real solution could be found in the “Dupplicate Sym” function ?

I think it’s a bug, but tell me if i’m wrong :blush:

mGear version : 4.1, 4.2 (from what i’ve tested)

No sure if I can consider an issue or bug. But the result of how each component is design, unless it is a strong case, it is very low priority to update the design from my side.
Maybe try the offset joint rotation option to set the joints to your desire orientation :slight_smile:

I knew you were going to answer that😅
You right, it is the behavior of the guide.
Updating the joint rotation only update the orientation of the joint, not the controller, so for animators it just adds a little inconsistancy and makes me few more steps to reproduce the same behavior than body guides.
At least I would have tried haha :grinning_face_with_smiling_eyes:

1 Like

Thanks for the answer anyway !

1 Like

I have another question :
Why does my guide axis on mirrored guides are different than the object space axis ?
Here is an exemple :


Blue axis is facing down, but if i select it or build the guide, I have the Z axis aiming up.

It seems guide_axisShape are not following the orientation of the main transform.
Maybe this is a bug ? :smile:

For those who had the same initial issue, two solutions :

  • Override the joint orient offset from the guide
  • Mirror the transform from left to right, so controls, guide and joints will all have the same orientation.

I chose the second option using this PRE_ script I wrote :

from mgear.core import string
from mgear.shifter import guide
from mgear import pymaya as pm
from maya import cmds


def get_mirrored_matrix(source_matrix):
    mirror_values = [
        -1, 0, 0, 0,
        0, 1, 0, 0,
        0, 0, 1, 0,
        0, 0, 0, 1]
    mirror_mat = pm.datatypes.Matrix(mirror_values)
    return mirror_mat * source_matrix * mirror_mat


def mirror_guides():
    cmds.select(clear=True)

    rig = guide.Rig()
    success = rig.setFromSelection()
    # This method internally finds the 'guide' node or uses selection
    # and populates self.componentsIndex and self.components

    if not success:
        return

    # Iterate over the components
    for comp_name in rig.componentsIndex:
        comp_obj = rig.components[comp_name]
        comp_type = comp_obj.values.get("comp_type")
        side_label = comp_obj.values.get("comp_side")
        if comp_type in ["EPIC_layered_control_01", "control_01"] and side_label == "L":
            # Find right side
            r_comp_name = string.convertRLName(comp_name)

            r_comp_obj = rig.components.get(r_comp_name)
            if not r_comp_obj:
                cmds.warning(f"No opposite guide found for {comp_name}")
                continue

            # Update axis from matrix operations
            l_mat = comp_obj.root.getMatrix(worldSpace=True)
            new_mat = get_mirrored_matrix(l_mat)
            r_comp_obj.root.setMatrix(new_mat, worldSpace=True)
    return rig


mirror_guides()

Enjoy !

1 Like

Oh! that is not good. Can you create a ticket on github?
Thanks again for all the feedback :slight_smile:

1 Like

Got it, it’s because for my calculation I do a scale -1 on Z axis, and thought it could be shown by the local axis of the manipulator. Nevermind :slight_smile:
I will try to do the mirror another way, if you have some suggestions about using existing mGear functions, i would be glad to know !

Edit : I wrote a new version of the script that works well as PRE script and mirror each one :

  • control_01
  • EPIC_control_01
  • EPIC_Layered_Control_01
  • sdk_control_01

Feel free to ask if you need it!

1 Like

Thanks @remicc Really appreciate all your feedback and sharing your snippet for this :slight_smile:

1 Like