Exemple #1
0
        /*
        public static IEnumerator advanceOneLeg (LegController c, Leg advancingLeg, Leg helpingLeg)
        {
            yield return new WaitForFixedUpdate ();
            if(c.owner.legsPattern1.pauseOnStateChange) {
                Debug.Log("Breaking for change to pattern 1");
                Debug.Break();
                yield return new WaitForFixedUpdate ();
            }
            LegController.updateMotors (advancingLeg, advancingLeg.owner.legsPattern1.advancer.thigh, advancingLeg.owner.legsPattern1.advancer.shin);
            LegController.updateMotors (helpingLeg, helpingLeg.owner.legsPattern1.helper.thigh, helpingLeg.owner.legsPattern1.helper.shin);
            while (advancingLeg.hipToKnee.jointAngle - 1f > advancingLeg.hipToKneeTargetAngle) {
                yield return new WaitForFixedUpdate ();
            }

            if(advancingLeg.owner.legsPattern2.pauseOnStateChange) {
                Debug.Log("Breaking for change to pattern 2");
                Debug.Break();
                yield return new WaitForFixedUpdate ();
            }

            LegController.updateMotors (advancingLeg, advancingLeg.owner.legsPattern2.advancer.thigh, advancingLeg.owner.legsPattern2.advancer.shin);
            LegController.updateMotors (helpingLeg, helpingLeg.owner.legsPattern2.helper.thigh, helpingLeg.owner.legsPattern2.helper.shin);
            while (advancingLeg.kneeToFoot.jointAngle - 1f > advancingLeg.kneeToFootTargetAngle) {
                yield return new WaitForFixedUpdate ();
            }
        }*/
        public static IEnumerator walkRoutine(LegController c, Leg leg1, Leg leg2)
        {
            LegController.createMotors(c);

            //yield return leg1.owner.StartCoroutine(advanceOneLeg (leg1, leg2));
            //yield return leg2.owner.StartCoroutine(advanceOneLeg (leg2, leg1));

            yield return null;
        }
Exemple #2
0
 public static void drawLegGizmo(Leg leg)
 {
     Gizmos.color = leg.gizmoColor;
     Gizmos.DrawLine (leg.root.transform.position, leg.rootToBend.transform.position);
     Gizmos.DrawLine (leg.rootToBend.transform.position, leg.bendToEnd.transform.position);
     Gizmos.DrawLine (leg.bendToEnd.transform.position, leg.end.transform.position);
 }
Exemple #3
0
 public static void updateMotors(LegController lc, Leg l, MotorMotion h2k, MotorMotion k2f)
 {
     updateMotor(lc, l.rootToBend,h2k);
     updateMotor(lc, l.bendToEnd,k2f);
     l.state = "HipKnee: " + h2k + ", KneeFoot: " + k2f;
 }