private void Awake()
    {
        locomotionState = LocomotionState.StandingStill;

        leftLegFootStates  = leftLegEndEffector.GetComponent <FootStates>();
        rightLegFootStates = rightLegEndEffector.GetComponent <FootStates>();
    }
예제 #2
0
        public void update(FootTransitionEvents transitionEvent)
        {
            string debug = " " + this.type.ToString() + ": " + state.ToString() + " --> ";


            if (state == FootStates.ON_THE_FLOOR)
            {
                if (transitionEvent == FootTransitionEvents.ELEVATING)
                {
                    state = FootStates.RAISED_UP;
                }
            }
            else if (state == FootStates.RAISED_UP)
            {
                if (transitionEvent == FootTransitionEvents.MAX_REACHED)
                {
                    state = FootStates.RAISED_DOWN;
                }
            }
            else if (state == FootStates.RAISED_DOWN)
            {
                if (transitionEvent == FootTransitionEvents.RESTING_DOWN)
                {
                    state = FootStates.ON_THE_FLOOR;
                }
            }

            printDebug(debug + state.ToString());
        }
예제 #3
0
        public WipFoot(Type type)
        {
            this.type     = type;
            Y             = 0.0f;
            dY            = 0.0f;
            dv            = 0.0f;
            lastStepTime  = 0;
            _lastVelocity = 0.0f;
            numSteps      = 0;

            velocity = 0.0f;
            supportedBetweenSteps = false;
            state = FootStates.ON_THE_FLOOR;

            OutputEnabled = false;
        }
예제 #4
0
    private void Start()
    {
        bCurveFootTrajectory = curveTrajectory.GetComponent <BezierCurveFootTrajectory>();
        controlPoints[0]     = curveTrajectory.transform.GetChild(0).gameObject;
        controlPoints[1]     = curveTrajectory.transform.GetChild(1).gameObject;
        controlPoints[2]     = curveTrajectory.transform.GetChild(2).gameObject;
        controlPoints[3]     = curveTrajectory.transform.GetChild(3).gameObject;

        isGroundedRayLength = GetComponent <SphereCollider>().radius;

        footStates     = GetComponent <FootStates>();
        footPlacement  = spine.GetComponent <Placement>();
        bCurveFollower = target.GetComponent <BezierCurveFollower>();

        footStates.footState = FootStates.FootState.onStart;
    }
예제 #5
0
    private void Start()
    {
        legLocomotionScript = spine.GetComponent <LegLocomotionPlacement3D>();

        bCurveFootTrajectory = curveTrajectory.GetComponent <BezierTrajectoryBubble3D>();
        controlPoints[0]     = curveTrajectory.transform.GetChild(0).gameObject;
        controlPoints[1]     = curveTrajectory.transform.GetChild(1).gameObject;
        controlPoints[2]     = curveTrajectory.transform.GetChild(2).gameObject;
        controlPoints[3]     = curveTrajectory.transform.GetChild(3).gameObject;

        isGroundedRayLength = 0.4f;

        footStates     = GetComponent <FootStates>();
        footPlacement  = spine.GetComponent <Placement>();
        bCurveFollower = target.GetComponent <BezierCurveFollower>();

        footStates.footState = FootStates.FootState.onStart;
    }
예제 #6
0
    //gait locomotion phases - used as the logic cycle for driving the biped walk
    void Step()
    {
        switch (footStates.footState)
        {
        case FootStates.FootState.onStart:
            break;

        case FootStates.FootState.Attach:
            footStates.footState = FootStates.FootState.Support;
            break;

        case FootStates.FootState.Support:

            PivotHipsAround();
            break;

        case FootStates.FootState.PreExit:
            break;

        case FootStates.FootState.Exit:
            isGrounded = false;
            PositionBezierPoints();
            footStates.footState = FootStates.FootState.Swing;
            break;

        case FootStates.FootState.Swing:
            if (Vector3.Distance(transform.position, controlPoints[3].transform.position) < 1f)
            {
                if (this.gameObject == leftFoot)
                {
                    FootStates otherFootScript = rightFoot.GetComponent <FootStates>();
                    otherFootScript.footState = FootStates.FootState.Exit;
                }
                else if (this.gameObject == rightFoot)
                {
                    FootStates otherFootScript = leftFoot.GetComponent <FootStates>();
                    otherFootScript.footState = FootStates.FootState.Exit;
                }

                CheckGrounded();
            }
            break;
        }
    }