iTween.ApplyMoveToPathTargets C# (CSharp) Method

ApplyMoveToPathTargets() private method

private ApplyMoveToPathTargets ( ) : void
return void
    void ApplyMoveToPathTargets()
    {
        preUpdate = transform.position;
        float t = ease(0,1,percentage);
        float lookAheadAmount;

        //clamp easing equation results as "back" will fail since overshoots aren't handled in the Catmull-Rom interpolation:
        if(isLocal){
            transform.localPosition=path.Interp(Mathf.Clamp(t,0,1));
        }else{
            transform.position=path.Interp(Mathf.Clamp(t,0,1));
        }

        //handle orient to path request:
        if(tweenArguments.Contains("orienttopath") && (bool)tweenArguments["orienttopath"]){

            //plot a point slightly ahead in the interpolation by pushing the percentage forward using the default lookahead value:
            float tLook;
            if(tweenArguments.Contains("lookahead")){
                lookAheadAmount = (float)tweenArguments["lookahead"];
            }else{
                lookAheadAmount = Defaults.lookAhead;
            }
            //tLook = ease(0,1,percentage+lookAheadAmount);
            tLook = ease(0,1, Mathf.Min(1f, percentage+lookAheadAmount));

            //locate new leading point with a clamp as stated above:
            //Vector3 lookDistance = path.Interp(Mathf.Clamp(tLook,0,1)) - transform.position;
            tweenArguments["looktarget"] = path.Interp(Mathf.Clamp(tLook,0,1));
        }

        //need physics?
        postUpdate=transform.position;
        if(physics){
            transform.position=preUpdate;
            rigidbody.MovePosition(postUpdate);
        }
    }
iTween