Answered

On recording runtime animations and blend trees

zacphillipshemming 5 years ago updated by Peter - Soxware Developer 5 years ago 6

Hi Soxware,

We love the asset and have a quick question recording and baking animations. We are trying to solve a problem with melee combat animations. The animations are "in-place" and the character swings his weapon whilst standing still. As we wanted to be able to move whilst attacking/blocking we chose to use layers and layer upper body of the melee swings over the walking locomotion blend tree. This obviously produces incorrect results as the hips are rotated differently when the character is walking compared to the original "in-place" animtion. To solve the hip bone being in the wrong rotation, we have a second animator where we play the original "in-place" animation and set the layered animators hip bone to be the same as this second animator's (in lateUpdate). However we would prefer not to need two animators per character. Can we use the asset to record the "new" position of the hips for a melee swing animation and bake it in?.I hope I explained this well enough.

Thanks

Zac

UMotion Version:
1.19p03
Unity Version:
2018.3

Answer

Answer
Answered

Hi Zac,

thank you very much for your support request.

UMotion supports animation layers (similar to the animation layers of an animator component, but baked into the animation once exported). If you import two animations, you can e.g. copy the hips rotation of one animation and paste it into an override animation layer of the second animation (thus overriding the hips). You can also use the additive animation layer to add a fixed rotation offset to the hips.


In this video tutorial I'm using animation layers in practical use-cases: 

You can also check out the manual (click on the black info button in the animation layers window) for further information.


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

Best regards,
Peter

Answer
Answered

Hi Zac,

thank you very much for your support request.

UMotion supports animation layers (similar to the animation layers of an animator component, but baked into the animation once exported). If you import two animations, you can e.g. copy the hips rotation of one animation and paste it into an override animation layer of the second animation (thus overriding the hips). You can also use the additive animation layer to add a fixed rotation offset to the hips.


In this video tutorial I'm using animation layers in practical use-cases: 

You can also check out the manual (click on the black info button in the animation layers window) for further information.


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

Best regards,
Peter

Hi Peter, Sorry for the very late reply, I have just gotten back from holiday. Thanks for the response, we will look into this and get back to you.

Zac

Hi Peter, upon playing around with the asset a bit, I have narrowed down what we would like to achieve. We are looking for a way to take a full body melee attack animation, and strip out the legs and hips from the animation. Secondly we need to add the rotation of the hips to the next bone along, the "stomach", so that the upper body behaves as it did before. Essentially is there a way to add the keyframes of one bone to another, such that only one bone is now being manipulated? This means we can use this new animation as an override mask on the walking blendtree. Is this possible? Thanks

Hi Zac,
I hope you had a nice holiday.

To remove the animation from bones, just remove all the key frames from that specific bone.

To add some additional rotation to a bone, you can either use an additive animation layer inside UMotion to add a rotation offset on top of the existing rotation of a bone or you could simply adjust the rotation by replacing existing key frames. If you set the rotation mode to euler interpolation, it's also possible to adjust rotations in the curves view (but be aware that euler can introduce gimbal lock effects).


More information about curves and rotation mode: 

Copy & paste rotation keys from one bone to another one is supported since UMotion V1.20 (i.e. the latest version at the time of writing). Copy & paste rotation keys most probably doesn't work as a rotation of for example x=90, y=0, z=0 could result in a different orientation on one bone than on the other because bones often have different initial orientations.

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

Best regards,
Peter

Thanks Peter, 
For some reason, when I make a new additive layer in umotion, and copy all the keyframes from the pelvis rotation to the pelvis of the new layer (i am still on version 1.19p03) the whole character rotates by about 90 degrees, so they're facing the ground. I assumed this was because I hadn't deleted the old pelvis rotation, but this still happens when copying the pelvis rotation, deleting it, and pasting it into the pelvis rotation of the additive layer.

Before I dive into this route, I would like to ask you if what I am trying to do will achieve what I want. If I successfully copy the pelvis rotation into the additive layer, and then delete the pelvis (and also leg) keys in the base layer, will I get an animation that only uses the spine and above, but where the spine still behaves as if it is being influenced by a pelvis? This is what we need as the pelvis and below is being controlled by a blend tree in the animator (for walking), and we need the spine and above on an override layer (for using a sword). 

Thanks

Zac

Additive means rotations in that layer are added to the rotation of the sub layer. So if you copy the same rotation to the additive layer you get twice the rotation, that's probably not what you want. If you want to override the rotation you need to use an override layer.

Simply copying & pasting like you suggested won't work because the rotation of bone A results in a different rotation on bone B due to different initial orientations.

I think you should re-create the effect of the pelvis animation by hand. Create a duplication of your model that plays the original animation (using Unity's Animation Window). Use the Sync button to keep the UMotion editor and the Animation Window frame cursor in sync. Delete the pelvis keys from your animation (in UMotion) and start to manipulate the keys of the spine bone so that it matches the source animation as close as possible.

More information about the syncing feature can be found in the manual.


Best regards,
Peter