Animation mirroring

Hello everybody,
I’m currently working on a XNA project using Maya and for my pipeline I need to be able to flip animations within Maya without flipping the skeleton.
I’ve been able to do it on simple static skeletons (using matrices transformations) but as soon as I get IKs, everything is blowing up :frowning: (apparently because of the rotation of the bones/IKs).
So, does anyone knows of a script wich could flip animations depending on an axis plane? (such as X=0) Or does anyone has a lead on what way I should begin searching?

getting maya`s skinned animations work in xna is a pain in butt could you please tell in detail regarding the blowing up part you said like is it distorting the mesh in a crazy manner or something similar ?

If your trying to mirror a rigged character then you shouldn’t need to worry about the joint rotates as it’s the IK that’s ultimately driving them. As long as your rig is relatively standard, and in T-pose the control values are similar from left to right, then you stand a good chance.

It all depends on how you’ve set the character up in the first place. Lets say in T-pose left and right feet / wrists all have frozen zero transforms. The first thing you need to do is to identify what axis you need to inverted to get the same data from left to right controller. On our setups we inverse tx, ry, rz animation data

Code side the key is being able to id left/right and centre controls, we build up arrays from markers on the controllers themselves. The anim process then goes something like this:

  • Copy animation data from left objects to matching right objects. Easiest thing to do here is to make a dummy object that you temporarily copy the left anim data too, then copy the right anim data over to the left control, and the dummy anim that you stored the left data on, over to the right controller. Now you have left and right anim copied.

  • Now for the channels you id’d as needing inverting you run a scale -1 on the animation curve values, inverting the data. Left and right are now mirrored.

  • Those controllers in the center array you simply run the scale -1 on the anim curves that require inverting.

That’s it. Kind of a simplified view but that’s the general id. Of course this all relies on a nice clean, consistent rig.

Mark