i wanted to ask for some best practices for doing Pose Mirroring and Pose Flipping within custom GUIs for character rigs.
How do you do it? Is there vector or matrix math involved or do you just read out transform values on one side and modify them
in a smart way to get the correct position on the other side?
I guess it all depends what you want to do. I’ve always built up a dict of matching left/right pairs of nodes within a rig then switched left to right and visa versa, then applied an inverse to the transforms as required. As for center nodes they just get the inverse. Same for animations, just copy left to right and scale -1 on the curves. The hard part is knowing case by case what channels to inverse, but then it’s easy enough if you store that data on the nodes.
There’s a full mirror pose and anim system in the Red9 pack if you want to take a look at it, happy to point you in the right direction.
It’s not just about symetrical rigs, it’s more about how each controller is setup in relation to the world, which axis you have to manipulate / inverse to get the data to work. Naming systems is one way, but naming conventions break and it’s way easier to just marker nodes up with bound data. In the Red9 mirror I use a side marker and an index slot, so I build up a dict from these of left, righ and center controllers, ordered by the index. That then means for switching left and right pairs as long as the index on left and right match, they get switched over. I also allow a mirrorAxis attr which can dictate an a node level what axis to treat during the mirror process.
At the moment you can only add these in code, I’ve not yet got round to adding a UI to the setups, but they’re dead easy to setup and there’s examples in the pack to do so.
The direction i was thinking about all the time, was to use the API and create some methods that would accept the root manipulator (to get the mirror axis) and the manips to mirror as well as the targets. (Either selectionlist or hardcoded for a GUI)
Then calculate the mirrored point position (translation matrix for mirror axis * -1 …!?!), set the translation matrix accordingly.
Then inverse the rotation matrix.
Then set the Scale Matrix to the one of the manip thats to be mirrored.
And then rebuild the whole transform matrix with these matrices and set it on the target transform node.
What i’m not sure about is, if the inverse of the rotation matrix will give me the correct mirrored result?
I’m really after a stable matrix math solution for all cases…