Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question Fixing / Setting Animator Default Pose for Runtime Generated Avatar

Discussion in 'Animation' started by noahteuscher, Jul 21, 2020.

  1. noahteuscher

    noahteuscher

    Joined:
    May 15, 2019
    Posts:
    1
    Hello,

    I have a project in which I am procedurally generating an Avatar at runtime. I parse an OBJ file, generate a mesh, skin the mesh, generate a skeleton, and finally create an Avatar object using AvatarBuilder.BuildHumanAvatar(). This all works properly, and avatar.IsValid is true. This is all done procedurally / at runtime; I have no pre-loaded Avatar asset.

    As a next step, I would like to use Inverse Kinematics to animate this Avatar into different poses. To do so, I have created an Animator, an AnimationController, and a script to control the IK. All of these components are attached to the prefab which gets instantiated at runtime and stores a SkinnedMeshRenderer, Bone GameObjects, GameObjects for IK targets, etc.

    The problem I am having is that when I set the Animator's avatar to the generated Avatar, the Animator automatically changes the pose of the avatar (the knees are bent, the arms are crossed in front of the body, the position of the avatar is lowered). All of the bones and skinning still works, and Inverse Kinematics works properly; however, the animations look very strange due to the awkward initial pose that the avatar is now in. I am wondering why the Animator changes the default pose of the Avatar, and how I can keep the default pose of the Avatar the same as it was before I added it to the Animator (if I just create the Avatar with BuildHumanAvatar but don't add it to the Animator, the pose is correct and I can successfully deform the mesh by manually rotating bone transforms).

    Based on the limited forums and documentation I can find, it appears that the Animator is automatically generating a default pose for my avatar, and that I need to create an Idle animation clip in which the avatar is in my desired default pose in the first frame. However, since the Avatar is generated at runtime, I don't have any asset to attach this Idle animation clip to.

    Would appreciate any help I can get on this issue. Thanks!
     
  2. erw29

    erw29

    Joined:
    Sep 27, 2018
    Posts:
    13
    Did you find a solution for this?
     
  3. Gaurav_zdre

    Gaurav_zdre

    Joined:
    Jan 13, 2021
    Posts:
    1
    Did anyone find a solution to this?