Answered

Chaining two animations with root motion

Anonymous 10 months ago updated by Peter - Soxware Developer 10 months ago 1

I am trying to chain two animations together. In the first the character turns 90 degrees and in the second he walks forward.When I add the second animation onto the first I use an additive layer to rotate the character and position him when the first animation stopped.It should work but the character instead of walking in the new forward direction continues to the side.

It looks like the root motion position is not a local as indicated but rather is the global position.

In fact it is the same problem if I try to rotate a single animation, for example a walk cycle at a 45 degree angle rather than forward.

How can I solve this?Thanks

UMotion Version:
Unity Version:

Answer

Answer
Answered

Hi,
thank you very much for your support request.

The problem that you have here, is that the local rotation doesn't affect the local position of a transform in Unity (due to the order in which they are applied). So when you adjust the hips rotation, it will not affect the hips local position (which drives the root motion). What you would need in order to rotate the root motion of your character is to rotate a parent transform of the hips, but this is not directly supported for humanoid characters within UMotion (as hips don't have a humanoid parent bone).

To offset root motion of humanoid characters, one way is to use the Inspector shown when the *.anim file is selected (see Root Transform Rotation Offset). Add an offset of 90° before you import it into your UMotion project to get the desired effect:

Another way would be that you (temporary) switch to generic. Duplicate your character and change it's rig to generic. Then create a new UMotion project of type generic and import your previous UMotion project of type humanoid. Then you can add a rotation offset to the hips parent transform (using an additive layer) to offset the root motion. Then export the animation to *.FBX (I recommend saving the animation into your humanoid character's *.FBX file, this ensures that the humanoid avatar setup is correct).

For putting several animations in sequence, there are specific animation sequencing programs made for that exact purpose. In the case of Unity it's called "Unity Timeline". This tool allows you to place sever animations after each other, loop animations and blend from one animation to the other. This is more flexible and consumes less memory then creating long sequences as animation clips (as looping within an animation clip would mean that animation keys are duplicated). UMotion Pro has very good support for Unity Timeline.

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

Best regards,
Peter

Answer
Answered

Hi,
thank you very much for your support request.

The problem that you have here, is that the local rotation doesn't affect the local position of a transform in Unity (due to the order in which they are applied). So when you adjust the hips rotation, it will not affect the hips local position (which drives the root motion). What you would need in order to rotate the root motion of your character is to rotate a parent transform of the hips, but this is not directly supported for humanoid characters within UMotion (as hips don't have a humanoid parent bone).

To offset root motion of humanoid characters, one way is to use the Inspector shown when the *.anim file is selected (see Root Transform Rotation Offset). Add an offset of 90° before you import it into your UMotion project to get the desired effect:

Another way would be that you (temporary) switch to generic. Duplicate your character and change it's rig to generic. Then create a new UMotion project of type generic and import your previous UMotion project of type humanoid. Then you can add a rotation offset to the hips parent transform (using an additive layer) to offset the root motion. Then export the animation to *.FBX (I recommend saving the animation into your humanoid character's *.FBX file, this ensures that the humanoid avatar setup is correct).

For putting several animations in sequence, there are specific animation sequencing programs made for that exact purpose. In the case of Unity it's called "Unity Timeline". This tool allows you to place sever animations after each other, loop animations and blend from one animation to the other. This is more flexible and consumes less memory then creating long sequences as animation clips (as looping within an animation clip would mean that animation keys are duplicated). UMotion Pro has very good support for Unity Timeline.

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

Best regards,
Peter