Skip to content

Malfunction when baking prefab with attachment #119

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
bbccyy opened this issue Aug 9, 2022 · 0 comments
Open

Malfunction when baking prefab with attachment #119

bbccyy opened this issue Aug 9, 2022 · 0 comments

Comments

@bbccyy
Copy link

bbccyy commented Aug 9, 2022

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]);
        }
    }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant