Beispiel #1
0
        /**
         *      determine the estimate desired location of the swing foot, given the etimated position of the COM, and the phase
         */
        virtual public Vector3 computeSwingFootLocationEstimate(Vector3 comPos, float phase)
        {
            Vector3 step = lowLCon.computeIPStepLocation();

            //applying the IP prediction would make the character stop, so take a smaller step if you want it to walk faster, or larger
            //if you want it to go backwards
            //step.x += lowLCon.velDSagittal / 20;
            //and adjust the stepping in the coronal plane in order to account for desired step width...
            step[lowLCon.getLocalFrontAxisID()] = adjustSagittalStepLocation(step[lowLCon.getLocalFrontAxisID()]);
            step[lowLCon.getLocalLeftAxisID()]  = adjustCoronalStepLocation(step[lowLCon.getLocalLeftAxisID()]);

            Vector3 result      = Vector3.zero;
            Vector3 initialStep = swingFootStartPos - comPos;

            initialStep = Quaternion.Inverse(lowLCon.getCharacterFrame()) * initialStep;
            //when phi is small, we want to be much closer to where the initial step is - so compute this quantity in character-relative coordinates
            //now interpolate between this position and initial foot position - but provide two estimates in order to provide some gradient information
            float t = (1 - phase);

            t = t * t;
            t = Mathf.Clamp(t, 0.0f, 1.0f);

            result += (step * (1 - t));
            result += (initialStep * t);

            result[lowLCon.getLocalUpAxisID()] = 0;

            return(result);
        }