コード例 #1
0
        public static void AddNewQuadruped()
        {
            GameObject root     = createCommon("Moveen quadruped");
            Stepper5   stepper5 = root.GetComponent <MoveenStepper5>().engine;

            stepper5.leadingLegRight       = 0;
            stepper5.leadingLegLeft        = 2;
            stepper5.forceBipedalEarlyStep = false;
//            root.transform.position = root.transform.position.withSetY(0.6f);

            float w  = 0.3f;
            float v  = 0.8f;
            float lh = -0.6f;

            //legs
            {
                GameObject leg = new GameObject("Anim leg FR");
                leg.transform.parent        = root.transform;
                leg.transform.localPosition = new Vector3(w, lh, -w);
                MoveenStep2     step = leg.AddComponent <MoveenStep2>();
                MoveenSkelLimb1 skel = leg.AddComponent <MoveenSkelLimb1>();
                step.step.comfortPosRel        = new Vector3(v, -1, -v);
                skel.targetPosRel              = step.step.comfortPosRel;
                skel.rotJoint.axisRel          = new Vector3(0, 1, 0);
                skel.rotJoint.secondaryAxisRel = new Vector3(1, 0, -1).normalized;
                skel.footPlatformHeight        = 0.1f;
            }

            {
                GameObject leg = new GameObject("Anim leg BL");
                leg.transform.parent        = root.transform;
                leg.transform.localPosition = new Vector3(-w, lh, w);
                MoveenStep2     step = leg.AddComponent <MoveenStep2>();
                MoveenSkelLimb1 skel = leg.AddComponent <MoveenSkelLimb1>();
                step.step.comfortPosRel        = new Vector3(-v, -1, v);
                skel.targetPosRel              = step.step.comfortPosRel;
                skel.rotJoint.axisRel          = new Vector3(0, 1, 0);
                skel.rotJoint.secondaryAxisRel = new Vector3(-1, 0, 1).normalized;
                skel.footPlatformHeight        = 0.1f;
            }

            {
                GameObject leg = new GameObject("Anim leg FL");
                leg.transform.parent        = root.transform;
                leg.transform.localPosition = new Vector3(w, lh, w);
                MoveenStep2     step = leg.AddComponent <MoveenStep2>();
                MoveenSkelLimb1 skel = leg.AddComponent <MoveenSkelLimb1>();
                step.step.comfortPosRel        = new Vector3(v, -1, v);
                skel.targetPosRel              = step.step.comfortPosRel;
                skel.rotJoint.axisRel          = new Vector3(0, 1, 0);
                skel.rotJoint.secondaryAxisRel = new Vector3(1, 0, 1).normalized;
                skel.footPlatformHeight        = 0.1f;
            }

            {
                GameObject leg = new GameObject("Anim leg BR");
                leg.transform.parent        = root.transform;
                leg.transform.localPosition = new Vector3(-w, lh, -w);
                MoveenStep2     step = leg.AddComponent <MoveenStep2>();
                MoveenSkelLimb1 skel = leg.AddComponent <MoveenSkelLimb1>();
                step.step.comfortPosRel        = new Vector3(-v, -1, -v);
                skel.targetPosRel              = step.step.comfortPosRel;
                skel.rotJoint.axisRel          = new Vector3(0, 1, 0);
                skel.rotJoint.secondaryAxisRel = new Vector3(-1, 0, -1).normalized;
                skel.footPlatformHeight        = 0.1f;
            }

            foreach (var step in root.GetComponentsInChildren <MoveenStep2>())
            {
                step.step.stepSpeedMin       = 6f;
                step.step.stepSpeedMin       = 6f;
                step.step.comfortRadiusRatio = 0.7f;
            }
        }