iTween.ApplyPunchPositionTargets C# (CSharp) Method

ApplyPunchPositionTargets() private method

private ApplyPunchPositionTargets ( ) : void
return void
    void ApplyPunchPositionTargets()
    {
        preUpdate = transform.position;

        //reset rotation to prevent look interferences as object rotates and attempts to move with translate and record current rotation
        Vector3 currentRotation = new Vector3();

        if(tweenArguments.Contains("looktarget")){
            currentRotation = transform.eulerAngles;
            transform.eulerAngles = vector3s[4];
        }

        //calculate:
        if(vector3s[1].x>0){
            vector3s[2].x = punch(vector3s[1].x,percentage);
        }else if(vector3s[1].x<0){
            vector3s[2].x=-punch(Mathf.Abs(vector3s[1].x),percentage);
        }
        if(vector3s[1].y>0){
            vector3s[2].y=punch(vector3s[1].y,percentage);
        }else if(vector3s[1].y<0){
            vector3s[2].y=-punch(Mathf.Abs(vector3s[1].y),percentage);
        }
        if(vector3s[1].z>0){
            vector3s[2].z=punch(vector3s[1].z,percentage);
        }else if(vector3s[1].z<0){
            vector3s[2].z=-punch(Mathf.Abs(vector3s[1].z),percentage);
        }

        //apply:
        transform.Translate(vector3s[2]-vector3s[3],space);

        //record:
        vector3s[3]=vector3s[2];

        //reset rotation:
        if(tweenArguments.Contains("looktarget")){
            transform.eulerAngles = currentRotation;
        }

        //dial in:
        /*
        if(percentage==1){
            transform.position=vector3s[0];
        }
        */

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