Answered

difference after exporting animation

Smart 1 year ago updated by Peter - Soxware Developer 1 year ago 3

I'm having a different result after exporting my animation.

Image 1264

after exporting,the chunlian's position is diffrent.

Image 1265

UMotion Version:
Editor 1.27
Unity Version:
2020.3.37

Answer

Answer
Answered

Hi,

thank you very much for your support request.

This is a typical issue when using humanoid and has something to do with how humanoid works under the hood.


There are two solutions:

1) Turn on humanoid's hand IK (can only be done via script) to tell humanoid that you need the hands to be precisely where you've authored them.

2) Use generic instead of humanoid. Contrary to humanoid, generic just takes an authored animation clip as an input and plays it 1:1 as it is.


Humanoid is an animation re-targeting system designed to allow sharing an animation across multiple characters by imitating the look of an animation. Humanoid is not suited for precise things as it looses precision due to "re-targeting errors". More info about humanoid's inner workings: https://blog.unity.com/technology/mecanim-humanoids

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

Best regards,
Peter

Answer
Answered

Hi,

thank you very much for your support request.

This is a typical issue when using humanoid and has something to do with how humanoid works under the hood.


There are two solutions:

1) Turn on humanoid's hand IK (can only be done via script) to tell humanoid that you need the hands to be precisely where you've authored them.

2) Use generic instead of humanoid. Contrary to humanoid, generic just takes an authored animation clip as an input and plays it 1:1 as it is.


Humanoid is an animation re-targeting system designed to allow sharing an animation across multiple characters by imitating the look of an animation. Humanoid is not suited for precise things as it looses precision due to "re-targeting errors". More info about humanoid's inner workings: https://blog.unity.com/technology/mecanim-humanoids

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

Best regards,
Peter

Hi,

thank you very much for your support request.

May I ask how to turn on humanoid's hank IK via script.where can i find the API.

Assign the following script to your character (at the same location where the Animator component is):

using UnityEngine;
using UnityEditor;
using System.Collections;

public class AnimatorHumanoidIK : MonoBehaviour
{
    [Header("Enable \"IK Pass\" in your Animator Controller!")]
    [Space(15)]
    public bool EnableFootIK = true;
    public bool EnableHandIK = true;

    private Animator animator = null;

    private void OnAnimatorIK(int layerIndex)
    {
        if (animator == null)
        {
            animator = GetComponent<animator>();
        }

        float footIKWeight = EnableFootIK ? 1 : 0;
        float handIKWeight = EnableHandIK ? 1 : 0;

        animator.SetIKPositionWeight(AvatarIKGoal.LeftFoot, footIKWeight);
        animator.SetIKPositionWeight(AvatarIKGoal.RightFoot, footIKWeight);
        animator.SetIKRotationWeight(AvatarIKGoal.LeftFoot, footIKWeight);
        animator.SetIKRotationWeight(AvatarIKGoal.RightFoot, footIKWeight);

        animator.SetIKPositionWeight(AvatarIKGoal.LeftHand, handIKWeight);
        animator.SetIKPositionWeight(AvatarIKGoal.RightHand, handIKWeight);
        animator.SetIKRotationWeight(AvatarIKGoal.LeftHand, handIKWeight);
        animator.SetIKRotationWeight(AvatarIKGoal.RightHand, handIKWeight);
    }
}


Also make sure you have the "IK Pass" toggle enabled in the Animator Controller:

image.png


More information about humanoid IK can be found in the "IK" chapter of this article: https://docs.unity3d.com/Manual/InverseKinematics.html


Best regards,
Peter