public void OnCharacterCompleted(UMAData umaData) { // Add the BipedIK component BipedIK bipedIK = umaData.gameObject.AddComponent <BipedIK>() as BipedIK; // Setup the bone references if (umaData.animator != null) { BipedReferences.AssignHumanoidReferences(ref bipedIK.references, umaData.animator, BipedReferences.AutoDetectParams.Default); } else { BipedReferences.AutoDetectReferences(ref bipedIK.references, umaData.umaRoot.transform, BipedReferences.AutoDetectParams.Default); } // Zero out the initial IK weights bipedIK.SetLookAtWeight(0f, 0f, 0f, 0f, 0f, 0f, 0f); bipedIK.SetSpineWeight(0f); bipedIK.SetIKPositionWeight(AvatarIKGoal.LeftFoot, 0f); bipedIK.SetIKRotationWeight(AvatarIKGoal.LeftFoot, 0f); bipedIK.SetIKPositionWeight(AvatarIKGoal.RightFoot, 0f); bipedIK.SetIKRotationWeight(AvatarIKGoal.RightFoot, 0f); bipedIK.SetIKPositionWeight(AvatarIKGoal.LeftHand, 0f); bipedIK.SetIKRotationWeight(AvatarIKGoal.LeftHand, 0f); bipedIK.GetGoalIK(AvatarIKGoal.LeftHand).bendModifier = IKSolverLimb.BendModifier.Arm; bipedIK.SetIKPositionWeight(AvatarIKGoal.RightHand, 0f); bipedIK.SetIKRotationWeight(AvatarIKGoal.RightHand, 0f); bipedIK.GetGoalIK(AvatarIKGoal.RightHand).bendModifier = IKSolverLimb.BendModifier.Arm; }
protected override void BaseAwake() { base.BaseAwake(); ik = GetComponent <BipedIK>(); headIKweight = WEIGHT_HEAD_IDLE; }
public void Build() { GameObject goC = this.gameObject; if (goA == null || goB == null || goC == null) { return; } Dictionary <string, Transform> bonesA = BuildBoneMap(goA); Dictionary <string, Transform> bonesB = BuildBoneMap(goB); Dictionary <string, Transform> bonesC = BuildBoneMap(goC); foreach (KeyValuePair <string, Transform> keypair in bonesC) { string bonename = keypair.Key; Transform t = keypair.Value; float y = t.position.y; if (bonesA.ContainsKey(bonename) && bonesB.ContainsKey(bonename)) { CombinedBone cb = t.gameObject.AddComponent <CombinedBone>(); cb.destc = t; cb.srca = bonesA[bonename]; cb.srcb = bonesB[bonename]; combinedbones[bonename] = cb; } else { Debug.Log("error bone=" + bonename); } } BuildBoneOrder(); SetDefaultWeightsSetting1(combinedbones.ContainsKey("Main/RootCopy/Root_M/BackA_M")); BipedIK bipedik = GetComponent <BipedIK>(); if (bipedik != null) { Transform troot = gameObject.transform.Find("Main"); if (troot != null) { bipedik.references.root = troot; } } }
// // private void Start() { BIK = GetComponent <BipedIK>(); Actor = GetComponent <Animator>(); Act = GetComponent <Animation>(); // if (LeftFootCurve.keys.Length == 0) { LeftFootCurve = new AnimationCurve(new Keyframe(0f, 1f), new Keyframe(1f, 0f)); } if (LeftSoleCurve.keys.Length == 0) { LeftSoleCurve = new AnimationCurve(new Keyframe(0f, 1f), new Keyframe(1f, 0f)); } if (RightFootCurve.keys.Length == 0) { RightFootCurve = new AnimationCurve(new Keyframe(0f, 1f), new Keyframe(1f, 0f)); } if (RightSoleCurve.keys.Length == 0) { RightSoleCurve = new AnimationCurve(new Keyframe(0f, 1f), new Keyframe(1f, 0f)); } }