Exemplo n.º 1
0
        // Token: 0x0600509F RID: 20639 RVA: 0x001B8E38 File Offset: 0x001B7238
        public static T CubicBezierTween <T>(IList <T> l, int idx, double delta) where T : TweenFunctions.IPositionSample
        {
            T       t         = l[idx];
            T       t2        = l[TweenFunctions.FindNextIndex <T>(l, idx)];
            Vector3 velocity  = t.Velocity;
            Vector3 position  = t.Position;
            double  time      = t.Time;
            Vector3 velocity2 = t2.Velocity;
            Vector3 position2 = t2.Position;
            double  time2     = t2.Time;
            float   num       = (float)delta;
            float   num2      = (float)(1.0 - delta);

            Vector3[]  array     = TweenFunctions.MakeCubicControlPoints(velocity, position, time, velocity2, position2, time2);
            Vector3    position3 = Mathf.Pow(num2, 3f) * position + 3f * num * Mathf.Pow(num2, 2f) * array[0] + 3f * Mathf.Pow(num, 2f) * num2 * array[1] + Mathf.Pow(num, 3f) * position2;
            Vector3    velocity3 = Vector3.Lerp(velocity, velocity2, (float)delta);
            Quaternion rotation  = Quaternion.Slerp(t.Rotation, t2.Rotation, (float)delta).Normalize();
            double     time3     = (t2.Time - t.Time) * delta + t.Time;
            T          result    = (T)((object)t2.Clone());

            result.Position = position3;
            result.Rotation = rotation;
            result.Velocity = velocity3;
            result.Time     = time3;
            return(result);
        }
Exemplo n.º 2
0
        // Token: 0x060050A0 RID: 20640 RVA: 0x001B9010 File Offset: 0x001B7410
        public static T CatMullRomTween <T>(IList <T> l, int idx, double delta) where T : TweenFunctions.IPositionSample
        {
            T       t        = l[TweenFunctions.FindPreviousIndex <T>(l, idx)];
            T       t2       = l[idx];
            int     num      = TweenFunctions.FindNextIndex <T>(l, idx);
            T       t3       = l[num];
            T       t4       = l[TweenFunctions.FindNextIndex <T>(l, num)];
            Vector3 vector   = 0.5f * (t3.Position - t.Position);
            Vector3 a        = 0.5f * (t4.Position - t2.Position);
            Vector3 vector2  = 0.5f * (t3.Velocity - t.Velocity);
            Vector3 a2       = 0.5f * (t4.Velocity - t2.Velocity);
            float   num2     = (float)delta;
            float   d        = (float)(delta * delta);
            float   d2       = (float)(delta * delta * delta);
            Vector3 position = t2.Position + num2 * vector + d * (-a - 2f * vector + 3f * t3.Position - 3f * t2.Position) + d2 * (a + vector + 2f * t2.Position + -2f * t3.Position);
            Vector3 velocity = t2.Velocity + num2 * vector2 + d * (-a2 - 2f * vector2 + 3f * t3.Velocity - 3f * t2.Velocity) + d2 * (a2 + vector2 + 2f * t2.Velocity + -2f * t3.Velocity);
            T       result   = (T)((object)t3.Clone());

            result.Position = position;
            result.Velocity = velocity;
            result.Rotation = Quaternion.Slerp(t2.Rotation, t3.Rotation, num2).Normalize();
            result.Time     = (t3.Time - t2.Time) * delta + t2.Time;
            return(result);
        }