iTween.ApplyShakeRotationTargets C# (CSharp) Method

ApplyShakeRotationTargets() private method

private ApplyShakeRotationTargets ( ) : void
return void
    void ApplyShakeRotationTargets()
    {
        preUpdate = transform.eulerAngles;

        //impact:
        if (percentage==0) {
            transform.Rotate(vector3s[1],space);
        }

        //reset:
        transform.eulerAngles=vector3s[0];

        //generate:
        float diminishingControl = 1-percentage;
        vector3s[2].x= UnityEngine.Random.Range(-vector3s[1].x*diminishingControl, vector3s[1].x*diminishingControl);
        vector3s[2].y= UnityEngine.Random.Range(-vector3s[1].y*diminishingControl, vector3s[1].y*diminishingControl);
        vector3s[2].z= UnityEngine.Random.Range(-vector3s[1].z*diminishingControl, vector3s[1].z*diminishingControl);

        //apply:
        transform.Rotate(vector3s[2],space);

        //need physics?
        postUpdate=transform.eulerAngles;
        if(physics){
            transform.eulerAngles=preUpdate;
            rigidbody.MoveRotation(Quaternion.Euler(postUpdate));
        }
    }
iTween