Malfunction when baking prefab with attachment
bbccyy opened this issue · 0 comments
bbccyy commented
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]);
}
}
}