// Use this for initialization void Start() { Pelvis = this.transform.Find("Armature/Parent/Pelvis").gameObject; Leg_L = this.transform.Find("Armature/Parent/Pelvis/Leg.L").gameObject; Knee_L = this.transform.Find("Armature/Parent/Pelvis/Leg.L/Knee.L").gameObject; Leg_R = this.transform.Find("Armature/Parent/Pelvis/Leg.R").gameObject; Knee_R = this.transform.Find("Armature/Parent/Pelvis/Leg.R/Knee.R").gameObject; Spine1 = this.transform.Find("Armature/Parent/Pelvis/Spine1").gameObject; Spine2 = this.transform.Find("Armature/Parent/Pelvis/Spine1/Spine2").gameObject; Head = this.transform.Find("Armature/Parent/Pelvis/Spine1/Spine2/Head").gameObject; LeftArm = this.transform.Find("Armature/Parent/Pelvis/Spine1/Spine2/LeftArm").gameObject; LeftElbow = this.transform.Find("Armature/Parent/Pelvis/Spine1/Spine2/LeftArm/LeftElbow").gameObject; RightArm = this.transform.Find("Armature/Parent/Pelvis/Spine1/Spine2/RightArm").gameObject; RightElbow = this.transform.Find("Armature/Parent/Pelvis/Spine1/Spine2/RightArm/RightElbow").gameObject; part = new GameObject[] { Pelvis, Leg_L, Knee_L, Leg_R, Knee_R, Spine1, Spine2, Head, LeftArm, LeftElbow, RightArm, RightElbow }; RB = new Rigidbody[] { Pelvis.GetComponent <Rigidbody>(), Leg_L.GetComponent <Rigidbody>(), Knee_L.GetComponent <Rigidbody>(), Leg_R.GetComponent <Rigidbody>(), Knee_R.GetComponent <Rigidbody>(), Spine1.GetComponent <Rigidbody>(), LeftArm.GetComponent <Rigidbody>(), LeftElbow.GetComponent <Rigidbody>(), RightArm.GetComponent <Rigidbody>(), RightElbow.GetComponent <Rigidbody>() }; foreach (Rigidbody rb in RB) { rb.velocity = vel; } int n = 0; foreach (Quaternion rot in rotation) { part[n].transform.rotation = rot; n++; } }
private void SpineRoot(Bone b) { Vector3 target = !Spine1.IsNaN() ? Spine1 : SternumClavicle; Vector3 pos = markers[m.bodyBase] + HipForward * BodyData.MarkerToSpineDist; b.Pos = pos; b.Orientation = QuaternionHelper2.LookAtUp(pos, target, HipForward); }
//ジャンプ(実際のジャンプ) IEnumerator JumpProc(Vector3 jumpForce, Vector3 forcePos) { rb.AddForceAtPosition(jumpForce * Multiplier, forcePos, ForceMode.Force); Spine1.AddForceAtPosition(jumpForce * Multiplier, forcePos, ForceMode.Force); //R_UpLeg.AddForceAtPosition(jumpForce * Multiplier / 2, forcePos, ForceMode.Force); //L_UpLeg.AddForceAtPosition(jumpForce * Multiplier / 2, forcePos, ForceMode.Force); rb_Trapaze.mass = 115f; rb_Trapaze.AddForceAtPosition(-jumpForce * Multiplier * 3, forcePos, ForceMode.Force); FreeClingJoints(); FreeHoldMascles(); mslL_UpLeg.Hold(180f); mslR_UpLeg.Hold(180f); mslL_Leg.Hold(180f); mslR_Leg.Hold(180f); stat = stat_enum.fly; StartCoroutine(DelayFreeHoldMasclesProc()); StartCoroutine(FlyProc()); yield break; }