Answered

Best way to horizontally flip a clip?

Erik Hermansen 3 years ago updated by Peter - Soxware Developer 3 years ago 7

I'd like to take a clip and swap all the keys left to right and right to left. E.g. left upper arm rotation becomes right upper arm rotation.

I know that there is a "Copy to the Other Side" feature. But it would be a lot of labor to go to each key and perform that copy. Also, there are times when I want to not just copy in one direction (left-to-right or right-to-left), but also perform a swap on the same key. So the "Copy to the Other Side" feature would actually overwrite a key that I need for the swap.

Is there an efficient way to swap all the keys in UMotion? Or maybe there is some way to edit keys that would be reasonably fast for my task?

I know that in Unity's animation controller you can flip a clip there, but I'm using Animancer instead which doesn't seem to allow flipping.

BTW, I really love UMotion. Thanks for making the great software.

UMotion Version:
1.26p02
Unity Version:
2019.4.13f1

Answer

Answer
Answered

Hi Erik,

thank you very much for your support request.

#3 - Duplicate the animation clip asset and check the "Mirror" checkbox in the inspector.

That's the method I would recommend. Please note that this method not only swaps left/right keys, but also mirrors the spine.

Also, there are times when I want to not just copy in one direction (left-to-right or right-to-left), but also perform a swap on the same key. So the "Copy to the Other Side" feature would actually overwrite a key that I need for the swap.

Swapping is supported by "Copy to Other Side". Just select both bones (on left and right side) and perform the action. Using shortcuts usually makes it really fast to use "Copy to Other Side" on all keys of an animation. I did something similar in this video tutorial:

(See 10:05)


BTW, I really love UMotion. Thanks for making the great software.

Thank you very much for the nice words, that means a lot to me :-)


Please let me know in case you have any follow-up questions.


Best regards,
Peter

GOOD, I'M SATISFIED
Satisfaction mark by Erik Hermansen 3 years ago

I now know three ways to do this! Documenting for posterity...

#1 - copy keys around inside UMotion.

#2 - make a copy of the .anim file and make "left" <-> "right" search/replace edits on the copy in a text editor. Import the hand-edited animation clip into a UMotion project.

#3 - Duplicate the animation clip asset and check the "Mirror" checkbox in the inspector.

#1 and #2 are slow and error-prone. Yeah, the last one seems the best way to do it, really.

Answer
Answered

Hi Erik,

thank you very much for your support request.

#3 - Duplicate the animation clip asset and check the "Mirror" checkbox in the inspector.

That's the method I would recommend. Please note that this method not only swaps left/right keys, but also mirrors the spine.

Also, there are times when I want to not just copy in one direction (left-to-right or right-to-left), but also perform a swap on the same key. So the "Copy to the Other Side" feature would actually overwrite a key that I need for the swap.

Swapping is supported by "Copy to Other Side". Just select both bones (on left and right side) and perform the action. Using shortcuts usually makes it really fast to use "Copy to Other Side" on all keys of an animation. I did something similar in this video tutorial:

(See 10:05)


BTW, I really love UMotion. Thanks for making the great software.

Thank you very much for the nice words, that means a lot to me :-)


Please let me know in case you have any follow-up questions.


Best regards,
Peter

> Swapping is supported by "Copy to Other Side". Just select both bones (on left and right side) and perform the action.

Ohhhhhhhhhh! :)

Nice. Thanks for the help.

Hi Peter. I am trying to flip all the animations of a dinosaur horizontally. It is a generic animal rig and so I cannot use the mirror option suggested above.

As for the swapping of keys left to right, it does not flip the spine rotation. I have got around 15 models with 5-8 animations each that requires their animations to be flipped. Can you please suggest a method that will help me quicky do this process?

I tried making the scale of all the bones -1, which gave me the results that I was looking for. However, the animation messes up when I transition from a non- flipped animation to a flipped animation (transition from an idle animation that is not flipped to an attack animation that is flipped).

Hi,

thanks for reaching out.

Currently there is no built in method in UMotion to mirror generic animations (as you mentioned, there is only a "copy to other side" functionality). If you want you could try using the UMotion API to perform a custom tailored mirroring for your situation:

ClipEditor.AddMenuItem() can be used to add a menu item to the clip editor's menu bar that triggers the mirroring.

ClipEditor.SetFrameCursor() can be used to iterate over the whole animation.

PoseEditor.TrySetFkRotation() can be used to adjust the rotation of bones and create new keys.

Manual: https://www.soxware.com/umotion-manual/UMotionAPI.html

To address your bones, either use PoseEditor.GetSelectedTransforms() or create a custom component (script) that you assign to your character (outside of UMotion) that holds public Transform fields for your bones. Assign the bones in the inspector, and in your mirror script use "GetComponent()" to query that custom component script.

Let me know in case you're discovering any issues with the UMotion API.

While generic mirroring in UMotion is a feature that is planned, I currently do not have an ETA for that.

Best regards,
Peter

Hi Peter,

Do you know if this can be achieved with 3D Software such as Blender? Do you have any recommendations on what add ons can be used to make this process quicker?

Yes usually 3D modelling software like Maya or Blender do have such a functionality. Unfortunately I don't know it out of my head how this can be done in Blender. Please search on google, I'm sure you're going to find something useful. 

Best regards,

Peter