static void MakeHead(Transform _headPoint, Transform _chestPoint, Vector3 _headTop) { float headScale = Vector3.Distance(_chestPoint.position, _headPoint.position) * .01f; Selection.activeObject = GameObject.Find("Spine_05"); Puppet2D_BoneCreation.CreateBoneTool(); Puppet2D_BoneCreation.BoneCreationMode(_headPoint.position); Puppet2D_BoneCreation.BoneCreationMode(_headTop); Puppet2D_BoneCreation.BoneFinishCreation(); GameObject head = GameObject.Find("bone_1"); head.name = "Head"; Selection.activeGameObject = head; GameObject headEnd = GameObject.Find("bone_2"); headEnd.name = "HeadEnd"; Puppet2D_CreateControls.CreateOrientControl(); GameObject headControl = GameObject.Find("Head_CTRL"); headControl.GetComponent <Puppet2D_ParentControl>().ConstrianedPosition = true; GameObject headControlParent = GameObject.Find("Head_CTRL_GRP"); headControlParent.transform.localScale = Vector3.one * headScale * 2f; //GameObject.Find ("bone_22").name = ("a"); }
static void MakeClav(GameObject parentTo, string boneName) { Selection.activeObject = parentTo; Puppet2D_BoneCreation.CreateBoneTool(); Puppet2D_BoneCreation.BoneCreationMode(parentTo.transform.position + Vector3.one * .1f); Puppet2D_BoneCreation.BoneFinishCreation(); GameObject clav = GameObject.Find("bone_1"); clav.name = boneName; }
static void MakeLimb(Transform _thighLPoint, Transform _footLPoint, Transform _kneePoint, Vector3 FootEnd, GameObject parentTo, string controlName, string controlName3, string controlName2, string controlName1, bool flip = false) { Selection.activeObject = parentTo; float limbScale = Vector3.Distance(_footLPoint.position, _thighLPoint.position) * .01f; Vector3 scaledFootPos = (_footLPoint.position - _thighLPoint.position) / limbScale; scaledFootPos += _thighLPoint.position; Vector3 scaledKneePos = (_kneePoint.position - _thighLPoint.position) / limbScale; scaledKneePos += _thighLPoint.position; Puppet2D_BoneCreation.CreateBoneTool(); Puppet2D_BoneCreation.BoneCreationMode(_thighLPoint.position); Puppet2D_BoneCreation.BoneCreationMode(scaledKneePos); GameObject endLimbGO = Puppet2D_BoneCreation.BoneCreationMode(scaledFootPos); Vector3 scaledFinalEndLimbGO = (FootEnd - _thighLPoint.position) / limbScale; scaledFinalEndLimbGO += _thighLPoint.position; GameObject finalEndLimbGO = Puppet2D_BoneCreation.BoneCreationMode(scaledFinalEndLimbGO); finalEndLimbGO.name = (controlName1 + "End"); Puppet2D_BoneCreation.BoneFinishCreation(); Selection.activeGameObject = endLimbGO; endLimbGO.name = controlName1; Puppet2D_CreateControls.IKCreateTool(true); GameObject limbControlParent = GameObject.Find(controlName1 + "_CTRL_GRP"); Transform elbow = endLimbGO.transform.parent; Transform shoulderBone = endLimbGO.transform.parent.parent; elbow.name = (controlName2); shoulderBone.name = (controlName3); Transform limbParent = limbControlParent.transform.parent; limbControlParent.transform.parent = shoulderBone; shoulderBone.localScale = shoulderBone.localScale * limbScale; limbControlParent.transform.parent = limbParent; GameObject.Find(controlName1 + "_CTRL").GetComponent <Puppet2D_IKHandle>().Flip = flip; }