public MFABone(MFASkeletalModel model, GameObject obj, MFABone parent) { m_GameObj = obj; m_Parent = parent; MeshRenderer cmMeshRenderer = m_GameObj.GetComponent <MeshRenderer>(); if (cmMeshRenderer != null) { model.RegMesh(this); } SkinnedMeshRenderer cmSkinnedMeshRenderer = m_GameObj.GetComponent <SkinnedMeshRenderer>(); if (cmSkinnedMeshRenderer != null) { model.RegSkeletal(this); } model.RegBone(this); //添加子骨骼 int childCount = m_GameObj.transform.childCount; for (int i = 0; i < childCount; i++) { GameObject childObj = m_GameObj.transform.GetChild(i).gameObject; m_Child.Add(new MFABone(model, childObj, this)); } }
/// <summary> /// 注册网格 /// </summary> /// <param name="bone"></param> public void RegMesh(MFABone bone) { Meshs.Add(bone); }
public void RegBone(MFABone bone) { BonesIndexByGameobj.Add(bone.gameObject, bone); }
/// <summary> /// 注册蒙皮 /// </summary> /// <param name="bone"></param> public void RegSkeletal(MFABone bone) { Skeletals.Add(bone); }