public Chain Copy() { Chain copy = new Chain(); foreach (Bone b in bones) { copy.AddBone(b.Copy()); } return(copy); }
public static Chain BuildChain(Transform root) { Chain chain = new Chain(); List <UnityJoint> jointsList = new List <UnityJoint>(); AddJoints(root, jointsList); for (int i = 0; i < jointsList.Count - 1; i++) { Joint baseJoint = new Joint(jointsList[i].GetComponent <UnityJoint>()); Joint tipJoint = new Joint(jointsList[i + 1].GetComponent <UnityJoint>()); Bone bone = new Bone(baseJoint, tipJoint); chain.AddBone(bone); } return(chain); }