Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Modify Humanoid Bone at Runtime

Discussion in 'Scripting' started by specterdragon, Jan 9, 2016.

  1. specterdragon

    specterdragon

    Joined:
    Dec 30, 2013
    Posts:
    21
    I've searched for an answer, but didn't see one. If I missed it, could someone point me in the right direction?

    What I'm trying to do is modify the bones assigned during model import of a mecanim humanoid at runtime. What I'm trying to accomplish is to duplicate an existing bone and then apply the new bone to the animation avatar. I found several reverences (including in Unity's scripting documentation) on how to do these assignments from scratch using the HumanDescription class and AvatarBuilder.BuildHumanAvatar.

    The problem with this approach is that I basically start with an empty HumanDescription and need to build the whole thing before passing it to BuildHumanAvatar. Since the names of bones may be different from model to model, I'm hoping there might be a better solution than using pre-defined bone names. All I really want to do is replace one bone in the mecanim rig with a different one.

    Anyone have any thoughts on this? The Avatar class doesn't contain the HumanDescription. Is there another way to get it from the model/animator at runtime? Does Unity even expose this information to the API?

    Any help is appreciated.
     
  2. specterdragon

    specterdragon

    Joined:
    Dec 30, 2013
    Posts:
    21
    Based on the lack of response (which is kind of unusual on this forum LOL), I'm going to assume no one's come across this issue - or those that have may not have seen this thread.

    I did find the following thread regarding manually building an avatar, if anyone else is interested. But so far, I haven't been able to make use of the info for what I'm trying to do - either that or I'm missing something. http://answers.unity3d.com/questions/622031/how-to-use-avatarbuilderbuildhumanavatar.html