Skip to content

Malfunction when baking prefab with attachment #119

Open
@bbccyy

Description

@bbccyy

The problem code locates right at method "BakeWithAnimator" in script file "AnimationGenerator.cs". For more details plz refer to the following code(and comments)

List<Transform> listExtra = new List<Transform>();
Transform[] trans = generatedFbx.GetComponentsInChildren<Transform>();          //all transforms in Attachment
Transform[] bakedTrans = generatedObject.GetComponentsInChildren<Transform>();  //all transforms in Avatar prefab
foreach (var obj in selectExtraBone)
{
    if (!obj.Value)
        continue;

    for (int i = 0; i != trans.Length; ++i)
    {
        Transform tran = trans[i] as Transform;
        if (tran.name == obj.Key)
        {
            bindPose.Add(tran.localToWorldMatrix);
            //以下为修改后代码 (replacement)
            for (int j = 0; j < bakedTrans.Length; ++j)
            {
                if (bakedTrans[j].name == obj.Key)
                {
                    listExtra.Add(bakedTrans[j]);
                    break;
                }
            }
            //以下为原始代码 (origin source code)
            //listExtra.Add(bakedTrans[i]);
        }
    }
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @bbccyy

        Issue actions

          Malfunction when baking prefab with attachment · Issue #119 · Unity-Technologies/Animation-Instancing