Search Unity

How does Unity calculate animator's center of mass(animator.bodyPosition)?

Discussion in 'Animation' started by DukeZ, Sep 15, 2017.

  1. DukeZ

    DukeZ

    Joined:
    Jul 25, 2013
    Posts:
    4
    As the Scripting API said, Animator.bodyPosition is:
    The position of the body center of mass.
    The position is in worldspace. You should only set this value from within an OnAnimatorIK() function call.
    https://docs.unity3d.com/ScriptReference/Animator-bodyPosition.html

    I have a character model with a Z-axis moving animation, when I tried to log bodyPosition, I meet some problems.

    Here are the settings and the result:



    There are some questions:
    1. When get in OnAnimatorMove(), the bodyPosition is not the same, and not in worldspace, why?
    2. The Animator.Root T curve is the animator.bodyPosition, and the Animator.Root Q curve is the animator.bodyRotation?
    3. Why the bodyPosition is not correct at first frame of the game?

    So..does anyone knows what is the real magic inside the animator.bodyPosition?

    AND how to calculate the root motion by center of mass and body orientation?
    https://blogs.unity3d.com/cn/2014/05/26/mecanim-humanoids/
     

    Attached Files:

    Last edited: Sep 15, 2017
    CloudyVR likes this.
  2. perholmes

    perholmes

    Joined:
    Dec 29, 2017
    Posts:
    296
    I wish somebody had answered, because that's my question too.
     
    CloudyVR likes this.
  3. Dream_Fields

    Dream_Fields

    Joined:
    Jul 24, 2023
    Posts:
    1
    Hello!Have you solved the problem?I have been puzzled by this question for a long time...